Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test for wp_cache_set_last_changed #5581

Closed
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions tests/phpunit/tests/functions/wpCacheSetLastChanged.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Tests for the wp_cache_set_last_changed function.
peterwilsoncc marked this conversation as resolved.
Show resolved Hide resolved
*
* @group functions.php
peterwilsoncc marked this conversation as resolved.
Show resolved Hide resolved
*
* @covers ::wp_cache_set_last_changed
*/#
peterwilsoncc marked this conversation as resolved.
Show resolved Hide resolved
class Tests_functions_wpCacheSetLastChanged extends WP_UnitTestCase {

/**
* check the cache_set_last_changed is set.
peterwilsoncc marked this conversation as resolved.
Show resolved Hide resolved
*
* @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() );
}
}
Loading