Role/Capability: Add tests for all user roles that check custom capabilities that do not have any form of handling (eg. in a `map_meta_cap` filter).

See #38191


git-svn-id: https://develop.svn.wordpress.org/trunk@38769 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2016-10-10 14:39:35 +00:00
parent 6774e27ae7
commit 0842857b5c
1 changed files with 7 additions and 1 deletions

View File

@ -457,9 +457,11 @@ class Tests_User_Capabilities extends WP_UnitTestCase {
}
$this->assertFalse( $user->has_cap( 'start_a_fire' ), "User with the {$role} role should not have a custom capability" );
$this->assertFalse( user_can( $user, 'start_a_fire' ), "User with the {$role} role should not have a custom capability" );
$this->assertFalse( $user->has_cap( 'do_not_allow' ), "User with the {$role} role should not have the do_not_allow capability" );
$this->assertFalse( user_can( $user, 'do_not_allow' ), "User with the {$role} role should not have the do_not_allow capability" );
}
// special case for the link manager
@ -527,6 +529,9 @@ class Tests_User_Capabilities extends WP_UnitTestCase {
$this->assertTrue( user_can( $user, $cap ), "Super Admins should have the {$cap} capability" );
}
$this->assertTrue( $user->has_cap( 'start_a_fire' ), "Super admins should have all custom capabilities" );
$this->assertTrue( user_can( $user, 'start_a_fire' ), "Super admins should have all custom capabilities" );
$this->assertFalse( $user->has_cap( 'do_not_allow' ), 'Super Admins should not have the do_not_allow capability' );
$this->assertFalse( user_can( $user, 'do_not_allow' ), 'Super Admins should not have the do_not_allow capability' );
@ -1479,6 +1484,7 @@ class Tests_User_Capabilities extends WP_UnitTestCase {
$this->assertFalse( current_user_can( $cap ), "Non-logged-in user should not have the {$cap} capability" );
}
$this->assertFalse( current_user_can( 'start_a_fire' ), "Non-logged-in user should not have a custom capability" );
$this->assertFalse( current_user_can( 'do_not_allow' ), "Non-logged-in user should not have the do_not_allow capability" );
}