Make WordPress Core


Ignore:
Timestamp:
10/21/2016 01:46:50 PM (8 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/capabilities.php

    r38829 r38860  
    13351335    }
    13361336
    1337     function test_multisite_user_can_edit_self() {
    1338         if ( ! is_multisite() ) {
    1339             $this->markTestSkipped( 'Test only runs in multisite' );
    1340             return;
    1341         }
    1342 
    1343         $user = self::$users['administrator'];
    1344 
    1345         wp_set_current_user( $user->ID );
    1346 
    1347         $this->assertTrue( current_user_can( 'edit_user', $user->ID ) );
     1337    function test_user_can_edit_self() {
     1338        foreach ( self::$users as $role => $user ) {
     1339            wp_set_current_user( $user->ID );
     1340            $this->assertTrue( current_user_can( 'edit_user', $user->ID ), "User with role {$role} should have the capability to edit their own profile" );
     1341        }
    13481342    }
    13491343
Note: See TracChangeset for help on using the changeset viewer.