|
@@ 257-268 (lines=12) @@
|
| 254 |
|
/** |
| 255 |
|
* Tests that the plugins in the cache are loaded. |
| 256 |
|
*/ |
| 257 |
|
public function test_gets_cached_plugins() { |
| 258 |
|
set_transient( Plugins_Handler::TRANSIENT_KEY, array( '{{WP_PLUGIN_PATH}}/plugins/dummy_newer' ) ); |
| 259 |
|
|
| 260 |
|
$this->path_processor->expects( $this->once() ) |
| 261 |
|
->method( 'untokenize_path_constants' ) |
| 262 |
|
->with( '{{WP_PLUGIN_PATH}}/plugins/dummy_newer' ) |
| 263 |
|
->willReturn( WP_PLUGIN_DIR . '/dummy_newer' ); |
| 264 |
|
|
| 265 |
|
$plugin_paths = $this->plugins_handler->get_cached_plugins(); |
| 266 |
|
|
| 267 |
|
$this->assertEquals( array( WP_PLUGIN_DIR . '/dummy_newer' ), $plugin_paths ); |
| 268 |
|
} |
| 269 |
|
|
| 270 |
|
/** |
| 271 |
|
* Tests that the plugins are updated when they have changed. |
|
@@ 273-282 (lines=10) @@
|
| 270 |
|
/** |
| 271 |
|
* Tests that the plugins are updated when they have changed. |
| 272 |
|
*/ |
| 273 |
|
public function test_updates_cache_writes_plugins() { |
| 274 |
|
$this->path_processor->expects( $this->once() ) |
| 275 |
|
->method( 'tokenize_path_constants' ) |
| 276 |
|
->with( WP_PLUGIN_DIR . '/dummy_newer' ) |
| 277 |
|
->willReturn( '{{WP_PLUGIN_PATH}}/plugins/dummy_newer' ); |
| 278 |
|
|
| 279 |
|
$this->plugins_handler->cache_plugins( array( WP_PLUGIN_DIR . '/dummy_newer' ) ); |
| 280 |
|
|
| 281 |
|
$this->assertEquals( array( '{{WP_PLUGIN_PATH}}/plugins/dummy_newer' ), get_transient( Plugins_Handler::TRANSIENT_KEY ) ); |
| 282 |
|
} |
| 283 |
|
|
| 284 |
|
/** |
| 285 |
|
* Tests that the handler indicate whether or not the plugins have changed from the global cached list. |