Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 205-223 (lines=19) @@
202
	/**
203
	 * Tests that single plugins activating this request are found.
204
	 */
205
	public function test_activating_this_request_works_for_single() {
206
		$_REQUEST['_wpnonce'] = '123abc';
207
		$_REQUEST['action']   = 'activate';
208
		$_REQUEST['plugin']   = 'dummy_current\\\\dummy_current.php';
209
210
		$this->path_processor->expects( $this->exactly( 2 ) )
211
			->method( 'find_directory_with_autoloader' )
212
			->withConsecutive(
213
				array( 0 ),
214
				array( 'dummy_current\\dummy_current.php' )
215
			)
216
			->willReturnOnConsecutiveCalls( false, TEST_DATA_PATH . '/plugins/dummy_current' );
217
218
		$plugin_paths = $this->locator->find_activating_this_request();
219
220
		$this->assertTrue( is_array( $plugin_paths ) );
221
		$this->assertCount( 1, $plugin_paths );
222
		$this->assertContains( TEST_DATA_PATH . '/plugins/dummy_current', $plugin_paths );
223
	}
224
225
	/**
226
	 * Tests that multiple plugins activating this request are found.
@@ 228-246 (lines=19) @@
225
	/**
226
	 * Tests that multiple plugins activating this request are found.
227
	 */
228
	public function test_activating_this_request_works_for_multiple() {
229
		$_REQUEST['_wpnonce'] = '123abc';
230
		$_REQUEST['action']   = 'activate-selected';
231
		$_REQUEST['checked']  = array( 'dummy_current\\\\dummy_current.php' );
232
233
		$this->path_processor->expects( $this->exactly( 2 ) )
234
			->method( 'find_directory_with_autoloader' )
235
			->withConsecutive(
236
				array( 0 ),
237
				array( 'dummy_current\\dummy_current.php' )
238
			)
239
			->willReturnOnConsecutiveCalls( false, TEST_DATA_PATH . '/plugins/dummy_current' );
240
241
		$plugin_paths = $this->locator->find_activating_this_request();
242
243
		$this->assertTrue( is_array( $plugin_paths ) );
244
		$this->assertCount( 1, $plugin_paths );
245
		$this->assertContains( TEST_DATA_PATH . '/plugins/dummy_current', $plugin_paths );
246
	}
247
}
248