From 3808c8c21db3cffb815f5d2597ed084c62fd196e Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 21 Oct 2016 13:46:50 +0000 Subject: [PATCH] Role/Capability: Improve the test which asserts that a user can edit their own profile. All users can edit their own profile, as this ability is not linked to an explicit capability. Technically, it should map to the `exist` capability, which will be addressed at a later date. See #31518 git-svn-id: https://develop.svn.wordpress.org/trunk@38860 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/user/capabilities.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/phpunit/tests/user/capabilities.php b/tests/phpunit/tests/user/capabilities.php index 9375054845..91d539dd52 100644 --- a/tests/phpunit/tests/user/capabilities.php +++ b/tests/phpunit/tests/user/capabilities.php @@ -1334,17 +1334,11 @@ class Tests_User_Capabilities extends WP_UnitTestCase { $this->assertFalse( current_user_can( 'edit_user', $other_user->ID ) ); } - function test_multisite_user_can_edit_self() { - if ( ! is_multisite() ) { - $this->markTestSkipped( 'Test only runs in multisite' ); - return; + function test_user_can_edit_self() { + foreach ( self::$users as $role => $user ) { + wp_set_current_user( $user->ID ); + $this->assertTrue( current_user_can( 'edit_user', $user->ID ), "User with role {$role} should have the capability to edit their own profile" ); } - - $user = self::$users['administrator']; - - wp_set_current_user( $user->ID ); - - $this->assertTrue( current_user_can( 'edit_user', $user->ID ) ); } /**