From 4a39dde8f540cc408c8c5ad650c247c1f11aa705 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 18 Jul 2016 22:38:18 +0000 Subject: [PATCH] Role/Capability: Introduce capability tests for non-logged-in users. Fixes #37405 git-svn-id: https://develop.svn.wordpress.org/trunk@38096 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/user/capabilities.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/phpunit/tests/user/capabilities.php b/tests/phpunit/tests/user/capabilities.php index 87e498b952..4e740aee82 100644 --- a/tests/phpunit/tests/user/capabilities.php +++ b/tests/phpunit/tests/user/capabilities.php @@ -1183,4 +1183,16 @@ class Tests_User_Capabilities extends WP_UnitTestCase { } + public function testNonLoggedInUsersHaveNoCapabilities() { + + $this->assertFalse( is_user_logged_in() ); + + $caps = $this->getCapsAndRoles(); + + foreach ( $caps as $cap => $roles ) { + $this->assertFalse( current_user_can( $cap ), "Non-logged-in user should not have the {$cap} capability" ); + } + + } + }