Code Duplication    Length = 19-19 lines in 2 locations

projects/packages/autoloader/tests/php/tests/unit/PluginLocatorTest.php 2 locations

@@ 233-251 (lines=19) @@
230
	/**
231
	 * Tests that plugins in the request action can be found for single actions.
232
	 */
233
	public function test_using_request_action_works_for_single() {
234
		$_REQUEST['_wpnonce'] = '123abc';
235
		$_REQUEST['action']   = 'activate';
236
		$_REQUEST['plugin']   = 'dummy_current\\\\dummy_current.php';
237
238
		$this->path_processor->expects( $this->exactly( 2 ) )
239
			->method( 'find_directory_with_autoloader' )
240
			->withConsecutive(
241
				array( 0 ),
242
				array( 'dummy_current\\dummy_current.php' )
243
			)
244
			->willReturnOnConsecutiveCalls( false, WP_PLUGIN_DIR . '/dummy_current' );
245
246
		$plugin_paths = $this->locator->find_using_request_action( array( 'activate' ) );
247
248
		$this->assertTrue( is_array( $plugin_paths ) );
249
		$this->assertCount( 1, $plugin_paths );
250
		$this->assertContains( WP_PLUGIN_DIR . '/dummy_current', $plugin_paths );
251
	}
252
253
	/**
254
	 * Tests that plugins in the request action can be found for multiple actions.
@@ 256-274 (lines=19) @@
253
	/**
254
	 * Tests that plugins in the request action can be found for multiple actions.
255
	 */
256
	public function test_using_request_action_works_for_multiple() {
257
		$_REQUEST['_wpnonce'] = '123abc';
258
		$_REQUEST['action']   = 'activate-selected';
259
		$_REQUEST['checked']  = array( 'dummy_current\\\\dummy_current.php' );
260
261
		$this->path_processor->expects( $this->exactly( 2 ) )
262
			->method( 'find_directory_with_autoloader' )
263
			->withConsecutive(
264
				array( 0 ),
265
				array( 'dummy_current\\dummy_current.php' )
266
			)
267
			->willReturnOnConsecutiveCalls( false, WP_PLUGIN_DIR . '/dummy_current' );
268
269
		$plugin_paths = $this->locator->find_using_request_action( array( 'activate-selected' ) );
270
271
		$this->assertTrue( is_array( $plugin_paths ) );
272
		$this->assertCount( 1, $plugin_paths );
273
		$this->assertContains( WP_PLUGIN_DIR . '/dummy_current', $plugin_paths );
274
	}
275
}
276