mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-05-25 21:54:28 +00:00
Build/Test Tools: Introduce tests for wp_cache_set_last_changed().
Props pbearne. Fixes #59737. git-svn-id: https://develop.svn.wordpress.org/trunk@57060 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
35
tests/phpunit/tests/functions/wpCacheSetLastChanged.php
Normal file
35
tests/phpunit/tests/functions/wpCacheSetLastChanged.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Tests for the wp_cache_set_last_changed() function.
|
||||
*
|
||||
* @group functions
|
||||
*
|
||||
* @covers ::wp_cache_set_last_changed
|
||||
*/
|
||||
class Tests_functions_wpCacheSetLastChanged extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* Check the cache key last_changed is set for the specified group.
|
||||
*
|
||||
* @ticket 59737
|
||||
*/
|
||||
public function test_wp_cache_set_last_changed() {
|
||||
$group = 'group_name';
|
||||
|
||||
$this->assertSame( wp_cache_set_last_changed( $group ), wp_cache_get( 'last_changed', $group ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the action is called.
|
||||
*
|
||||
* @ticket 59737
|
||||
*/
|
||||
public function test_wp_cache_set_last_changed_action_is_called() {
|
||||
$a1 = new MockAction();
|
||||
add_action( 'wp_cache_set_last_changed', array( $a1, 'action' ) );
|
||||
|
||||
wp_cache_set_last_changed( 'group_name' );
|
||||
|
||||
$this->assertSame( 1, $a1->get_call_count() );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user