Code Duplication    Length = 12-12 lines in 2 locations

packages/autoloader/tests/php/tests/unit/test-autoloader.php 2 locations

@@ 146-157 (lines=12) @@
143
	/**
144
	 * Tests that activate removes the v2 autoload functions.
145
	 */
146
	public function test_activate_removes_v2_autoload_functions() {
147
		$removed_autoloader = 'Automattic\\Jetpack\\Autoloader\\jp123\\autoload';
148
		spl_autoload_register( $removed_autoloader );
149
150
		$this->version_loader->expects( $this->once() )->method( 'load_filemap' );
151
152
		Autoloader::activate( $this->version_loader );
153
154
		$autoloaders = spl_autoload_functions();
155
		$this->assertEquals( array( Autoloader::class, 'load_class' ), reset( $autoloaders ) );
156
		$this->assertNotContains( $removed_autoloader, $autoloaders );
157
	}
158
159
	/**
160
	 * Tests that activate removes the v2 autoload class.
@@ 162-173 (lines=12) @@
159
	/**
160
	 * Tests that activate removes the v2 autoload class.
161
	 */
162
	public function test_activate_removes_v2_class_autoloader() {
163
		$removed_autoloader = \Automattic\Jetpack\Autoloader\jp123\Autoloader::class . '::load_class';
164
		spl_autoload_register( $removed_autoloader );
165
166
		$this->version_loader->expects( $this->once() )->method( 'load_filemap' );
167
168
		Autoloader::activate( $this->version_loader );
169
170
		$autoloaders = spl_autoload_functions();
171
		$this->assertEquals( array( Autoloader::class, 'load_class' ), reset( $autoloaders ) );
172
		$this->assertNotContains( $removed_autoloader, $autoloaders );
173
	}
174
175
	/**
176
	 * Tests that class files are loaded correctly.