Changeset 1167 in tests
- Timestamp:
- 12/07/2012 09:52:21 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/tests/user/capabilities.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/user/capabilities.php
r1160 r1167 647 647 $this->assertEquals( $caps, $user->caps ); 648 648 } 649 650 function test_current_user_can_for_blog() { 651 $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); 652 $old_uid = get_current_user_id(); 653 set_current_user( $user->ID ); 654 655 $this->assertTrue( current_user_can_for_blog( get_current_blog_id(), 'edit_posts' ) ); 656 $this->assertFalse( current_user_can_for_blog( get_current_blog_id(), 'foo_the_bar' ) ); 657 if ( ! is_multisite() ) { 658 $this->assertTrue( current_user_can_for_blog( 12345, 'edit_posts' ) ); 659 return; 660 } 661 662 $this->assertFalse( current_user_can_for_blog( 12345, 'edit_posts' ) ); 663 664 $blog_id = $this->factory->blog->create( array( 'user_id' => $user->ID ) ); 665 $this->assertTrue( current_user_can_for_blog( $blog_id, 'edit_posts' ) ); 666 $this->assertFalse( current_user_can_for_blog( $blog_id, 'foo_the_bar' ) ); 667 668 set_current_user( $old_uid ); 669 } 649 670 }
Note: See TracChangeset
for help on using the changeset viewer.