|
@@ 490-498 (lines=9) @@
|
| 487 |
|
// make sure the role name is correct |
| 488 |
|
$this->assertEquals(array( $role ), $user->roles, "User should only have the {$role} role"); |
| 489 |
|
|
| 490 |
|
foreach ( $caps as $cap => $roles ) { |
| 491 |
|
if (in_array($role, $roles, true) ) { |
| 492 |
|
$this->assertTrue($user->has_cap($cap), "User with the {$role} role should have the {$cap} capability"); |
| 493 |
|
$this->assertTrue(user_can($user, $cap), "User with the {$role} role should have the {$cap} capability"); |
| 494 |
|
} else { |
| 495 |
|
$this->assertFalse($user->has_cap($cap), "User with the {$role} role should not have the {$cap} capability"); |
| 496 |
|
$this->assertFalse(user_can($user, $cap), "User with the {$role} role should not have the {$cap} capability"); |
| 497 |
|
} |
| 498 |
|
} |
| 499 |
|
|
| 500 |
|
} |
| 501 |
|
|
|
@@ 532-542 (lines=11) @@
|
| 529 |
|
update_option('link_manager_enabled', '1'); |
| 530 |
|
$this->assertSame('1', get_option('link_manager_enabled')); |
| 531 |
|
|
| 532 |
|
foreach ( self::$users as $role => $user ) { |
| 533 |
|
foreach ( $caps as $cap => $roles ) { |
| 534 |
|
if (in_array($role, $roles, true) ) { |
| 535 |
|
$this->assertTrue($user->has_cap($cap), "User with the {$role} role should have the {$cap} capability"); |
| 536 |
|
$this->assertTrue(user_can($user, $cap), "User with the {$role} role should have the {$cap} capability"); |
| 537 |
|
} else { |
| 538 |
|
$this->assertFalse($user->has_cap($cap), "User with the {$role} role should not have the {$cap} capability"); |
| 539 |
|
$this->assertFalse(user_can($user, $cap), "User with the {$role} role should not have the {$cap} capability"); |
| 540 |
|
} |
| 541 |
|
} |
| 542 |
|
} |
| 543 |
|
|
| 544 |
|
update_option('link_manager_enabled', '0'); |
| 545 |
|
$this->assertSame('0', get_option('link_manager_enabled')); |