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
This commit is contained in:
Sergey Biryukov 2022-03-06 23:02:12 +00:00
parent 864ab55b33
commit 34d98887a2

View File

@ -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() {