Code Duplication    Length = 13-13 lines in 3 locations

projects/packages/autoloader/tests/php/tests/unit/ManifestReaderTest.php 3 locations

@@ 91-103 (lines=13) @@
88
	/**
89
	 * Tests that a single plugin manifest can be read successfully.
90
	 */
91
	public function test_reads_single_plugin_manifest() {
92
		$input_array = array();
93
94
		$this->reader->read_manifests(
95
			array( TEST_PLUGIN_DIR ),
96
			'vendor/composer/jetpack_autoload_classmap.php',
97
			$input_array
98
		);
99
100
		$this->assertArrayHasKey( Classmap_Test_Class::class, $input_array );
101
		$this->assertEquals( Test_Plugin_Factory::VERSION_CURRENT, $input_array[ Classmap_Test_Class::class ]['version'] );
102
		$this->assertEquals( $input_array[ Classmap_Test_Class::class ]['path'], TEST_PLUGIN_DIR . '/includes/class-classmap-test-class.php' );
103
	}
104
105
	/**
106
	 * Tests that the reader only keeps the latest version when processing multiple manifests.
@@ 108-120 (lines=13) @@
105
	/**
106
	 * Tests that the reader only keeps the latest version when processing multiple manifests.
107
	 */
108
	public function test_read_overwrites_older_version_in_manifest() {
109
		$input_array = array();
110
111
		$this->reader->read_manifests(
112
			array( self::$older_plugin_dir, TEST_PLUGIN_DIR ),
113
			'vendor/composer/jetpack_autoload_classmap.php',
114
			$input_array
115
		);
116
117
		$this->assertArrayHasKey( Classmap_Test_Class::class, $input_array );
118
		$this->assertEquals( Test_Plugin_Factory::VERSION_CURRENT, $input_array[ Classmap_Test_Class::class ]['version'] );
119
		$this->assertEquals( $input_array[ Classmap_Test_Class::class ]['path'], TEST_PLUGIN_DIR . '/includes/class-classmap-test-class.php' );
120
	}
121
122
	/**
123
	 * Tests that the reader ignores older versions when a newer version is already set.
@@ 125-137 (lines=13) @@
122
	/**
123
	 * Tests that the reader ignores older versions when a newer version is already set.
124
	 */
125
	public function test_read_ignores_older_version_when_newer_already_loaded() {
126
		$input_array = array();
127
128
		$this->reader->read_manifests(
129
			array( TEST_PLUGIN_DIR, self::$older_plugin_dir ),
130
			'vendor/composer/jetpack_autoload_classmap.php',
131
			$input_array
132
		);
133
134
		$this->assertArrayHasKey( Classmap_Test_Class::class, $input_array );
135
		$this->assertEquals( Test_Plugin_Factory::VERSION_CURRENT, $input_array[ Classmap_Test_Class::class ]['version'] );
136
		$this->assertEquals( $input_array[ Classmap_Test_Class::class ]['path'], TEST_PLUGIN_DIR . '/includes/class-classmap-test-class.php' );
137
	}
138
}
139