WordPress.org

Make WordPress Core

Changeset 38769


Ignore:
Timestamp:
10/10/2016 02:39:35 PM (20 months ago)
Author:
johnbillion
Message:

Role/Capability: Add tests for all user roles that check custom capabilities that do not have any form of handling (eg. in a map_meta_cap filter).

See #38191

File:
1 edited

Legend:

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

    r38732 r38769  
    458458        }
    459459
     460        $this->assertFalse( $user->has_cap( 'start_a_fire' ), "User with the {$role} role should not have a custom capability" );
     461        $this->assertFalse( user_can( $user, 'start_a_fire' ), "User with the {$role} role should not have a custom capability" );
     462
    460463        $this->assertFalse( $user->has_cap( 'do_not_allow' ), "User with the {$role} role should not have the do_not_allow capability" );
    461464        $this->assertFalse( user_can( $user, 'do_not_allow' ), "User with the {$role} role should not have the do_not_allow capability" );
    462 
    463465    }
    464466
     
    527529            $this->assertTrue( user_can( $user, $cap ), "Super Admins should have the {$cap} capability" );
    528530        }
     531
     532        $this->assertTrue( $user->has_cap( 'start_a_fire' ), "Super admins should have all custom capabilities" );
     533        $this->assertTrue( user_can( $user, 'start_a_fire' ), "Super admins should have all custom capabilities" );
    529534
    530535        $this->assertFalse( $user->has_cap( 'do_not_allow' ), 'Super Admins should not have the do_not_allow capability' );
     
    14801485        }
    14811486
     1487        $this->assertFalse( current_user_can( 'start_a_fire' ), "Non-logged-in user should not have a custom capability" );
    14821488        $this->assertFalse( current_user_can( 'do_not_allow' ), "Non-logged-in user should not have the do_not_allow capability" );
    14831489    }
Note: See TracChangeset for help on using the changeset viewer.