Changeset 34091 for trunk/tests/phpunit/tests/user/capabilities.php
- Timestamp:
- 09/12/2015 09:26:57 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/capabilities.php
r33988 r34091 995 995 $this->assertFalse( current_user_can( 'edit_user', $super_admin->ID ) ); 996 996 } 997 998 /** 999 * @ticket 16956 1000 */ 1001 function test_require_edit_others_posts_if_post_type_doesnt_exist() { 1002 register_post_type( 'existed' ); 1003 $post_id = $this->factory->post->create( array( 'post_type' => 'existed' ) ); 1004 _unregister_post_type( 'existed' ); 1005 1006 $subscriber_id = $this->factory->user->create( array( 'role' => 'subscriber' ) ); 1007 $editor_id = $this->factory->user->create( array( 'role' => 'editor' ) ); 1008 1009 $this->setExpectedIncorrectUsage( 'map_meta_cap' ); 1010 foreach ( array( 'delete_post', 'edit_post', 'read_post', 'publish_post' ) as $cap ) { 1011 wp_set_current_user( $subscriber_id ); 1012 $this->assertSame( array( 'edit_others_posts' ), map_meta_cap( $cap, $subscriber_id, $post_id ) ); 1013 $this->assertFalse( current_user_can( $cap, $post_id ) ); 1014 1015 wp_set_current_user( $editor_id ); 1016 $this->assertSame( array( 'edit_others_posts' ), map_meta_cap( $cap, $editor_id, $post_id ) ); 1017 $this->assertTrue( current_user_can( $cap, $post_id ) ); 1018 } 1019 } 997 1020 }
Note: See TracChangeset
for help on using the changeset viewer.