Code Duplication    Length = 14-15 lines in 2 locations

packages/autoloader/tests/php/tests/test_autoloader_handler.php 2 locations

@@ 62-76 (lines=15) @@
59
	/**
60
	 * Tests should_autoloader_reset() with an already active plugin.
61
	 */
62
	public function test_should_autoloader_reset_known_plugin() {
63
		global $jetpack_autoloader_activating_plugins_paths;
64
		global $jetpack_autoloader_cached_plugin_paths;
65
		$jetpack_autoloader_cached_plugin_paths = array( TEST_DATA_PATH . '/plugins/plugin_current' );
66
67
		$autoloader_handler = new Autoloader_Handler(
68
			TEST_DATA_PATH . '/plugins/plugin_current',
69
			array( TEST_DATA_PATH . '/plugins/plugin_current' ),
70
			new Autoloader_Locator( new Version_Selector() ),
71
			new Version_Selector()
72
		);
73
74
		$this->assertFalse( $autoloader_handler->should_autoloader_reset() );
75
		$this->assertEmpty( $jetpack_autoloader_activating_plugins_paths );
76
	}
77
78
	/**
79
	 * Tests should_autoloader_reset() with an activating, unknown plugin.
@@ 99-112 (lines=14) @@
96
	/**
97
	 * Tests should_autoloader_reset() with an old cache set of plugin paths.
98
	 */
99
	public function test_should_autoloader_reset_invalid_cache() {
100
		global $jetpack_autoloader_cached_plugin_paths;
101
		$jetpack_autoloader_cached_plugin_paths = array();
102
103
		$autoloader_handler = new Autoloader_Handler(
104
			TEST_DATA_PATH . '/plugins/plugin_current',
105
			array( TEST_DATA_PATH . '/plugins/plugin_current' ),
106
			new Autoloader_Locator( new Version_Selector() ),
107
			new Version_Selector()
108
		);
109
110
		$this->assertTrue( $autoloader_handler->should_autoloader_reset() );
111
		$this->assertEquals( array( TEST_DATA_PATH . '/plugins/plugin_current' ), $jetpack_autoloader_cached_plugin_paths );
112
	}
113
114
	/**
115
	 * Tests that the handler is able to build a loader.