@@ 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 an empty array is returned when the cache contains invalid data. |
|
@@ 287-296 (lines=10) @@ | ||
284 | /** |
|
285 | * Tests that the plugins are updated when they have changed. |
|
286 | */ |
|
287 | public function test_updates_cache_writes_plugins() { |
|
288 | $this->path_processor->expects( $this->once() ) |
|
289 | ->method( 'tokenize_path_constants' ) |
|
290 | ->with( WP_PLUGIN_DIR . '/dummy_newer' ) |
|
291 | ->willReturn( '{{WP_PLUGIN_PATH}}/plugins/dummy_newer' ); |
|
292 | ||
293 | $this->plugins_handler->cache_plugins( array( WP_PLUGIN_DIR . '/dummy_newer' ) ); |
|
294 | ||
295 | $this->assertEquals( array( '{{WP_PLUGIN_PATH}}/plugins/dummy_newer' ), get_transient( Plugins_Handler::TRANSIENT_KEY ) ); |
|
296 | } |
|
297 | ||
298 | /** |
|
299 | * Tests that the handler indicate whether or not the plugins have changed from the global cached list. |