@@ 506-511 (lines=6) @@ | ||
503 | $this->assertSame( '0', get_option( 'link_manager_enabled' ) ); |
|
504 | ||
505 | // no-one should have access to the link manager by default |
|
506 | foreach ( self::$users as $role => $user ) { |
|
507 | foreach ( $caps as $cap => $roles ) { |
|
508 | $this->assertFalse( $user->has_cap( $cap ), "User with the {$role} role should not have the {$cap} capability" ); |
|
509 | $this->assertFalse( user_can( $user, $cap ), "User with the {$role} role should not have the {$cap} capability" ); |
|
510 | } |
|
511 | } |
|
512 | ||
513 | update_option( 'link_manager_enabled', '1' ); |
|
514 | $this->assertSame( '1', get_option( 'link_manager_enabled' ) ); |
|
@@ 651-654 (lines=4) @@ | ||
648 | ||
649 | $caps = $this->getAllCapsAndRoles(); |
|
650 | ||
651 | foreach ( $caps as $cap => $roles ) { |
|
652 | $this->assertFalse( $user->has_cap( $cap ), "User with an invalid role should not have the {$cap} capability" ); |
|
653 | $this->assertFalse( user_can( $user, $cap ), "User with an invalid role should not have the {$cap} capability" ); |
|
654 | } |
|
655 | } |
|
656 | ||
657 | // a user with multiple roles |
|
@@ 707-710 (lines=4) @@ | ||
704 | ||
705 | $caps = $this->getAllCapsAndRoles(); |
|
706 | ||
707 | foreach ( $caps as $cap => $roles ) { |
|
708 | $this->assertFalse( $user->has_cap( $cap ), "User should not have the {$cap} capability" ); |
|
709 | $this->assertFalse( user_can( $user, $cap ), "User should not have the {$cap} capability" ); |
|
710 | } |
|
711 | ||
712 | // clean up |
|
713 | remove_role( $role_name ); |