| | 528 | * @ticket 27020 |
| | 529 | */ |
| | 530 | function test_authorless_post() { |
| | 531 | |
| | 532 | // Make a post without an author |
| | 533 | $post = $this->factory->post->create( array( 'post_author' => 0, 'post_type' => 'post', 'post_status' => 'draft' ) ); |
| | 534 | |
| | 535 | // Add an editor and contributor |
| | 536 | $editor = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) ); |
| | 537 | $contributor = new WP_User( $this->factory->user->create( array( 'role' => 'contributor' ) ) ); |
| | 538 | |
| | 539 | // editor can edit, view, and trash |
| | 540 | $this->assertTrue( $editor->has_cap( 'edit_post', $post ) ); |
| | 541 | $this->assertTrue( $editor->has_cap( 'read_post', $post ) ); |
| | 542 | $this->assertTrue( $editor->has_cap( 'delete_post', $post ) ); |
| | 543 | // an contributor cannot |
| | 544 | $this->assertFalse( $contributor->has_cap( 'edit_post', $post ) ); |
| | 545 | $this->assertFalse( $contributor->has_cap( 'read_post', $post ) ); |
| | 546 | $this->assertFalse( $contributor->has_cap( 'delete_post', $post ) ); |
| | 547 | |
| | 548 | } |
| | 549 | |
| | 550 | /** |