mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-07 08:07:16 +00:00
Capabilities: When creating an auto-draft, ensure that the current user still has permission to do so.
git-svn-id: https://develop.svn.wordpress.org/trunk@33357 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -926,4 +926,14 @@ class Tests_User_Capabilities extends WP_UnitTestCase {
|
||||
$user->remove_cap( 'publish_pages' );
|
||||
$this->assertFalse( $user->has_cap( 'publish_pages' ) );
|
||||
}
|
||||
|
||||
function test_subscriber_cant_edit_posts() {
|
||||
$user = new WP_User( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
|
||||
wp_set_current_user( $user->ID );
|
||||
|
||||
$post = $this->factory->post->create( array( 'post_author' => 1 ) );
|
||||
|
||||
$this->assertFalse( current_user_can( 'edit_post', $post ) );
|
||||
$this->assertFalse( current_user_can( 'edit_post', $post + 1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user