From 75796f5e92a73e46c07d05e86293dc4f878a15ed Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Fri, 3 Nov 2023 23:27:35 +0000 Subject: [PATCH] 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 --- .../tests/functions/wpCacheSetLastChanged.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/phpunit/tests/functions/wpCacheSetLastChanged.php diff --git a/tests/phpunit/tests/functions/wpCacheSetLastChanged.php b/tests/phpunit/tests/functions/wpCacheSetLastChanged.php new file mode 100644 index 0000000000..9394801c96 --- /dev/null +++ b/tests/phpunit/tests/functions/wpCacheSetLastChanged.php @@ -0,0 +1,35 @@ +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() ); + } +}