Changeset 13980 for trunk/tests/phpunit/testcases/core/caps.php
- Timestamp:
- 07/27/2024 04:30:23 PM (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/caps.php
r13314 r13980 20 20 21 21 public function tear_down() { 22 self::set_current_user( $this->reset_user_id ); 22 23 parent::tear_down(); 23 24 $this->set_current_user( $this->reset_user_id );25 24 } 26 25 … … 33 32 $u = self::factory()->user->create(); 34 33 35 $this->set_current_user( $u );34 self::set_current_user( $u ); 36 35 37 36 add_filter( 'user_has_cap', array( $this, 'grant_cap_foo' ), 10, 2 ); … … 55 54 $u = self::factory()->user->create(); 56 55 57 $this->set_current_user( $u );56 self::set_current_user( $u ); 58 57 59 58 add_filter( 'user_has_cap', array( $this, 'grant_cap_foo' ), 10, 2 ); … … 89 88 ); 90 89 91 $this->set_current_user( $u );90 self::set_current_user( $u ); 92 91 93 92 $this->assertTrue( bp_current_user_can( 'bp_moderate' ), 'Administrator can `bp_moderate` on default WordPress config' ); … … 109 108 ); 110 109 111 $this->set_current_user( $u );110 self::set_current_user( $u ); 112 111 113 112 $this->assertTrue( bp_current_user_can( 'bp_moderate' ), 'Users having a `manage_options` cap into their role can `bp_moderate`' ); … … 131 130 ); 132 131 133 $this->set_current_user( $u1 );132 self::set_current_user( $u1 ); 134 133 135 134 $email = self::factory()->post->create( … … 141 140 $this->assertTrue( current_user_can( 'edit_post', $email ), 'Administrator should be able to edit emails they created' ); 142 141 143 $this->set_current_user( $u2 );142 self::set_current_user( $u2 ); 144 143 145 144 $this->assertTrue( current_user_can( 'edit_post', $email ), 'Administrator should be able to edit emails others created when BuddyPress is not network activated' ); … … 172 171 switch_to_blog( $this->blog_id ); 173 172 174 $this->set_current_user( $u1 );173 self::set_current_user( $u1 ); 175 174 $this->assertTrue( bp_current_user_can( 'bp_moderate' ), 'Only Super Admins can `bp_moderate` when BuddyPress is network activated' ); 176 175 177 $this->set_current_user( $u2 );176 self::set_current_user( $u2 ); 178 177 179 178 $this->assertFalse( bp_current_user_can( 'bp_moderate' ), 'Regular Admins cannot `bp_moderate` when BuddyPress is network activated' ); … … 220 219 restore_current_blog(); 221 220 222 $this->set_current_user( $u1 );221 self::set_current_user( $u1 ); 223 222 $this->assertTrue( current_user_can( 'edit_post', $email ), 'Super Admins should be able to edit emails they created' ); 224 223 225 $this->set_current_user( $u2 );224 self::set_current_user( $u2 ); 226 225 $this->assertFalse( current_user_can( 'edit_post', $email ), 'Administrator should not be able to edit emails others created when BuddyPress is network activated' ); 227 226
Note: See TracChangeset
for help on using the changeset viewer.