From face5a97dd2611da21e2d19124da47a40c36edc2 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Tue, 7 Feb 2023 09:24:00 +0000 Subject: [PATCH] Build/Test Tools: Add unit tests for `wp_set_password` hook. Follow-up to [55056]. Props audrasjb, SergeyBiryukov, costdev. Fixes #57436. git-svn-id: https://develop.svn.wordpress.org/trunk@55250 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/auth.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/phpunit/tests/auth.php b/tests/phpunit/tests/auth.php index 2198fadcd0..4aa1d882c6 100644 --- a/tests/phpunit/tests/auth.php +++ b/tests/phpunit/tests/auth.php @@ -100,6 +100,22 @@ class Tests_Auth extends WP_UnitTestCase { } } + /** + * Tests hooking into wp_set_password(). + * + * @ticket 57436 + * + * @covers ::wp_set_password + */ + public function test_wp_set_password_action() { + $action = new MockAction(); + + add_action( 'wp_set_password', array( $action, 'action' ) ); + wp_set_password( 'A simple password', self::$user_id ); + + $this->assertSame( 1, $action->get_call_count() ); + } + /** * Test wp_hash_password trims whitespace *