From 34d98887a21db8e34e7e9118e00ae3a936200897 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 6 Mar 2022 23:02:12 +0000 Subject: [PATCH] Tests: Restore the original user role in the `(add|remove)_user_role` hooks test. This makes sure the test does not unintentionally affect other tests. Follow-up to [52823]. Fixes #54164. git-svn-id: https://develop.svn.wordpress.org/trunk@52824 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/user/capabilities.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/user/capabilities.php b/tests/phpunit/tests/user/capabilities.php index 5f838ac27d..71a4a12d59 100644 --- a/tests/phpunit/tests/user/capabilities.php +++ b/tests/phpunit/tests/user/capabilities.php @@ -1641,8 +1641,9 @@ class Tests_User_Capabilities extends WP_UnitTestCase { add_action( 'add_user_role', array( $add_user_role, 'action' ) ); $user->set_role( 'editor' ); - $this->assertSame( 1, $remove_user_role->get_call_count() ); - $this->assertSame( 1, $add_user_role->get_call_count() ); + $user->set_role( 'administrator' ); + $this->assertSame( 2, $remove_user_role->get_call_count() ); + $this->assertSame( 2, $add_user_role->get_call_count() ); } public function test_current_user_can_for_blog() {