Code Duplication    Length = 10-12 lines in 2 locations

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

@@ 191-202 (lines=12) @@
188
	/**
189
	 * Tests that the plugins in the cache are loaded.
190
	 */
191
	public function test_gets_cached_plugins() {
192
		set_transient( Plugins_Handler::TRANSIENT_KEY, array( '{{WP_PLUGIN_PATH}}/plugins/dummy_newer' ) );
193
194
		$this->path_processor->expects( $this->once() )
195
			->method( 'untokenize_path_constants' )
196
			->with( '{{WP_PLUGIN_PATH}}/plugins/dummy_newer' )
197
			->willReturn( TEST_DATA_PATH . '/plugins/dummy_newer' );
198
199
		$plugin_paths = $this->plugins_handler->get_cached_plugins();
200
201
		$this->assertEquals( array( TEST_DATA_PATH . '/plugins/dummy_newer' ), $plugin_paths );
202
	}
203
204
	/**
205
	 * Tests that the plugins are updated when they have changed.
@@ 207-216 (lines=10) @@
204
	/**
205
	 * Tests that the plugins are updated when they have changed.
206
	 */
207
	public function test_updates_cache_writes_plugins() {
208
		$this->path_processor->expects( $this->once() )
209
			->method( 'tokenize_path_constants' )
210
			->with( TEST_DATA_PATH . '/plugins/dummy_newer' )
211
			->willReturn( '{{WP_PLUGIN_PATH}}/plugins/dummy_newer' );
212
213
		$this->plugins_handler->cache_plugins( array( TEST_DATA_PATH . '/plugins/dummy_newer' ) );
214
215
		$this->assertEquals( array( '{{WP_PLUGIN_PATH}}/plugins/dummy_newer' ), get_transient( Plugins_Handler::TRANSIENT_KEY ) );
216
	}
217
218
	/**
219
	 * Tests that the handler indicate whether or not the plugins have changed from the global cached list.