Changeset 33988 for trunk/tests/phpunit/tests/user/capabilities.php
- Timestamp:
- 09/10/2015 03:33:22 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/capabilities.php
r33987 r33988 964 964 $this->assertTrue( current_user_can( 'edit_user', $user->ID ) ); 965 965 } 966 967 function test_multisite_administrator_with_manage_network_users_can_edit_users() { 968 if ( ! is_multisite() ) { 969 $this->markTestSkipped( 'Test only runs in multisite' ); 970 return; 971 } 972 973 $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); 974 $user->add_cap( 'manage_network_users' ); 975 $other_user = new WP_User( $this->factory->user->create( array( 'role' => 'subscriber' ) ) ); 976 977 wp_set_current_user( $user->ID ); 978 979 $this->assertTrue( current_user_can( 'edit_user', $other_user->ID ) ); 980 } 981 982 function test_multisite_administrator_with_manage_network_users_can_not_edit_super_admin() { 983 if ( ! is_multisite() ) { 984 $this->markTestSkipped( 'Test only runs in multisite' ); 985 return; 986 } 987 988 $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); 989 $user->add_cap( 'manage_network_users' ); 990 $super_admin = new WP_User( $this->factory->user->create( array( 'role' => 'subscriber' ) ) ); 991 grant_super_admin( $super_admin->ID ); 992 993 wp_set_current_user( $user->ID ); 994 995 $this->assertFalse( current_user_can( 'edit_user', $super_admin->ID ) ); 996 } 966 997 }
Note: See TracChangeset
for help on using the changeset viewer.