WordPress.org

Make WordPress Core

Changeset 38096


Ignore:
Timestamp:
07/18/2016 10:38:18 PM (4 years ago)
Author:
johnbillion
Message:

Role/Capability: Introduce capability tests for non-logged-in users.

Fixes #37405

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/capabilities.php

    r37157 r38096  
    11841184    }
    11851185
     1186    public function testNonLoggedInUsersHaveNoCapabilities() {
     1187
     1188        $this->assertFalse( is_user_logged_in() );
     1189
     1190        $caps = $this->getCapsAndRoles();
     1191
     1192        foreach ( $caps as $cap => $roles ) {
     1193            $this->assertFalse( current_user_can( $cap ), "Non-logged-in user should not have the {$cap} capability" );
     1194        }       
     1195
     1196    }
     1197
    11861198}
Note: See TracChangeset for help on using the changeset viewer.