Make WordPress Core


Ignore:
Timestamp:
07/23/2015 04:26:36 AM (9 years ago)
Author:
pento
Message:

Capabilities: When creating an auto-draft, ensure that the current user still has permission to do so.

Partial merge of [33357] to the 3.7 branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.7/tests/phpunit/tests/user/capabilities.php

    r32202 r33379  
    699699        wp_set_current_user( $old_uid );
    700700    }
     701
     702    function test_subscriber_cant_edit_posts() {
     703        $user = new WP_User( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
     704        wp_set_current_user( $user->ID );
     705
     706        $post = $this->factory->post->create( array( 'post_author' => 1 ) );
     707
     708        $this->assertFalse( current_user_can( 'edit_post', $post ) );
     709        $this->assertFalse( current_user_can( 'edit_post', $post + 1 ) );
     710    }
    701711}
Note: See TracChangeset for help on using the changeset viewer.