|
@@ 250-268 (lines=19) @@
|
| 247 |
|
/** |
| 248 |
|
* Tests that plugins in the request action can be found for single actions. |
| 249 |
|
*/ |
| 250 |
|
public function test_using_request_action_works_for_single() { |
| 251 |
|
$_REQUEST['_wpnonce'] = '123abc'; |
| 252 |
|
$_REQUEST['action'] = 'activate'; |
| 253 |
|
$_REQUEST['plugin'] = 'dummy_current\\\\dummy_current.php'; |
| 254 |
|
|
| 255 |
|
$this->path_processor->expects( $this->exactly( 2 ) ) |
| 256 |
|
->method( 'find_directory_with_autoloader' ) |
| 257 |
|
->withConsecutive( |
| 258 |
|
array( 0 ), |
| 259 |
|
array( 'dummy_current\\dummy_current.php' ) |
| 260 |
|
) |
| 261 |
|
->willReturnOnConsecutiveCalls( false, WP_PLUGIN_DIR . '/dummy_current' ); |
| 262 |
|
|
| 263 |
|
$plugin_paths = $this->locator->find_using_request_action( array( 'activate' ) ); |
| 264 |
|
|
| 265 |
|
$this->assertTrue( is_array( $plugin_paths ) ); |
| 266 |
|
$this->assertCount( 1, $plugin_paths ); |
| 267 |
|
$this->assertContains( WP_PLUGIN_DIR . '/dummy_current', $plugin_paths ); |
| 268 |
|
} |
| 269 |
|
|
| 270 |
|
/** |
| 271 |
|
* Tests that plugins in the request action can be found for multiple actions. |
|
@@ 273-291 (lines=19) @@
|
| 270 |
|
/** |
| 271 |
|
* Tests that plugins in the request action can be found for multiple actions. |
| 272 |
|
*/ |
| 273 |
|
public function test_using_request_action_works_for_multiple() { |
| 274 |
|
$_REQUEST['_wpnonce'] = '123abc'; |
| 275 |
|
$_REQUEST['action'] = 'activate-selected'; |
| 276 |
|
$_REQUEST['checked'] = array( 'dummy_current\\\\dummy_current.php' ); |
| 277 |
|
|
| 278 |
|
$this->path_processor->expects( $this->exactly( 2 ) ) |
| 279 |
|
->method( 'find_directory_with_autoloader' ) |
| 280 |
|
->withConsecutive( |
| 281 |
|
array( 0 ), |
| 282 |
|
array( 'dummy_current\\dummy_current.php' ) |
| 283 |
|
) |
| 284 |
|
->willReturnOnConsecutiveCalls( false, WP_PLUGIN_DIR . '/dummy_current' ); |
| 285 |
|
|
| 286 |
|
$plugin_paths = $this->locator->find_using_request_action( array( 'activate-selected' ) ); |
| 287 |
|
|
| 288 |
|
$this->assertTrue( is_array( $plugin_paths ) ); |
| 289 |
|
$this->assertCount( 1, $plugin_paths ); |
| 290 |
|
$this->assertContains( WP_PLUGIN_DIR . '/dummy_current', $plugin_paths ); |
| 291 |
|
} |
| 292 |
|
} |
| 293 |
|
|