Changeset 27390 for trunk/tests/phpunit/tests/user/capabilities.php
- Timestamp:
- 03/04/2014 03:08:54 AM (12 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/user/capabilities.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/capabilities.php
r25409 r27390 523 523 $this->assertFalse( $admin->has_cap('delete_post_meta', $post, 'not_protected') ); 524 524 } 525 } 526 527 function authorless_post_statuses() { 528 return array( array( 'draft' ), array( 'private' ), array( 'publish' ) ); 529 } 530 531 /** 532 * @ticket 27020 533 * @dataProvider authorless_post_statuses 534 */ 535 function test_authorless_post( $status ) { 536 // Make a post without an author 537 $post = $this->factory->post->create( array( 'post_author' => 0, 'post_type' => 'post', 'post_status' => $status ) ); 538 539 // Add an editor and contributor 540 $editor = $this->factory->user->create_and_get( array( 'role' => 'editor' ) ); 541 $contributor = $this->factory->user->create_and_get( array( 'role' => 'contributor' ) ); 542 543 // editor can edit, view, and trash 544 $this->assertTrue( $editor->has_cap( 'edit_post', $post ) ); 545 $this->assertTrue( $editor->has_cap( 'delete_post', $post ) ); 546 $this->assertTrue( $editor->has_cap( 'read_post', $post ) ); 547 548 // a contributor cannot (except read a published post) 549 $this->assertFalse( $contributor->has_cap( 'edit_post', $post ) ); 550 $this->assertFalse( $contributor->has_cap( 'delete_post', $post ) ); 551 $this->assertEquals( $status === 'publish', $contributor->has_cap( 'read_post', $post ) ); 525 552 } 526 553
Note: See TracChangeset
for help on using the changeset viewer.