Code Duplication    Length = 19-19 lines in 2 locations

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

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