|
@@ 522-527 (lines=6) @@
|
| 519 |
|
$this->assertSame('0', get_option('link_manager_enabled')); |
| 520 |
|
|
| 521 |
|
// no-one should have access to the link manager by default |
| 522 |
|
foreach ( self::$users as $role => $user ) { |
| 523 |
|
foreach ( $caps as $cap => $roles ) { |
| 524 |
|
$this->assertFalse($user->has_cap($cap), "User with the {$role} role should not have the {$cap} capability"); |
| 525 |
|
$this->assertFalse(user_can($user, $cap), "User with the {$role} role should not have the {$cap} capability"); |
| 526 |
|
} |
| 527 |
|
} |
| 528 |
|
|
| 529 |
|
update_option('link_manager_enabled', '1'); |
| 530 |
|
$this->assertSame('1', get_option('link_manager_enabled')); |
|
@@ 685-688 (lines=4) @@
|
| 682 |
|
|
| 683 |
|
$caps = $this->getAllCapsAndRoles(); |
| 684 |
|
|
| 685 |
|
foreach ( $caps as $cap => $roles ) { |
| 686 |
|
$this->assertFalse($user->has_cap($cap), "User with an invalid role should not have the {$cap} capability"); |
| 687 |
|
$this->assertFalse(user_can($user, $cap), "User with an invalid role should not have the {$cap} capability"); |
| 688 |
|
} |
| 689 |
|
} |
| 690 |
|
|
| 691 |
|
// a user with multiple roles |
|
@@ 743-746 (lines=4) @@
|
| 740 |
|
|
| 741 |
|
$caps = $this->getAllCapsAndRoles(); |
| 742 |
|
|
| 743 |
|
foreach ( $caps as $cap => $roles ) { |
| 744 |
|
$this->assertFalse($user->has_cap($cap), "User should not have the {$cap} capability"); |
| 745 |
|
$this->assertFalse(user_can($user, $cap), "User should not have the {$cap} capability"); |
| 746 |
|
} |
| 747 |
|
|
| 748 |
|
// clean up |
| 749 |
|
remove_role($role_name); |