Ticket #17253: 17253-2.diff
| File 17253-2.diff, 3.4 KB (added by , 11 years ago) |
|---|
-
src/wp-admin/includes/schema.php
595 595 populate_roles_270(); 596 596 populate_roles_280(); 597 597 populate_roles_300(); 598 populate_roles_430(); 598 599 } 599 600 600 601 /** … … 843 844 } 844 845 845 846 /** 847 * Create and modify WordPress roles for WordPress 4.3. 848 * 849 * @since 4.3.0 850 */ 851 function populate_roles_430() { 852 $role = get_role( 'author' ); 853 854 if ( !empty( $role ) ) { 855 $role->add_cap( 'edit_pages' ); 856 $role->add_cap( 'publish_pages' ); 857 $role->add_cap( 'edit_published_pages' ); 858 $role->add_cap( 'delete_pages' ); 859 $role->add_cap( 'delete_published_pages' ); 860 } 861 } 862 863 /** 846 864 * Install Network. 847 865 * 848 866 * @since 3.0.0 -
tests/phpunit/tests/user/capabilities.php
89 89 $this->assertTrue($user->has_cap('upload_files')); 90 90 $this->assertTrue($user->has_cap('level_2')); 91 91 92 // extra author capabilities added in WordPress 4.3, @ticket 17253 93 $this->assertTrue( $user->has_cap( 'edit_pages' ) ); 94 $this->assertTrue( $user->has_cap( 'publish_pages' ) ); 95 $this->assertTrue( $user->has_cap( 'edit_published_pages' ) ); 96 $this->assertTrue( $user->has_cap( 'delete_pages' ) ); 97 $this->assertTrue( $user->has_cap( 'delete_published_pages' ) ); 98 92 99 // and a few capabilities this user doesn't have 93 100 $this->assertFalse($user->has_cap('moderate_comments')); 94 101 $this->assertFalse($user->has_cap('manage_categories')); … … 634 641 $editor = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) ); 635 642 $contributor = new WP_User( $this->factory->user->create( array( 'role' => 'contributor' ) ) ); 636 643 637 // administrators, editors and the p ostowner can edit it644 // administrators, editors and the page owner can edit it 638 645 $this->assertTrue($admin->has_cap('edit_page', $page)); 639 646 $this->assertTrue($editor->has_cap('edit_page', $page)); 647 $this->assertTrue($author->has_cap('edit_page', $page)); 640 648 // other authors and contributors can't 641 $this->assertFalse($author->has_cap('edit_page', $page));642 649 $this->assertFalse($author_2->has_cap('edit_page', $page)); 643 650 $this->assertFalse($contributor->has_cap('edit_page', $page)); 644 651 645 // administrators, editors and the p ostowner can delete it652 // administrators, editors and the page owner can delete it 646 653 $this->assertTrue($admin->has_cap('delete_page', $page)); 647 654 $this->assertTrue($editor->has_cap('delete_page', $page)); 655 $this->assertTrue($editor->has_cap('delete_page', $page)); 648 656 // other authors and contributors can't 649 657 $this->assertFalse($author->has_cap('delete_page', $page)); 650 658 $this->assertFalse($author_2->has_cap('delete_page', $page)); 651 659 $this->assertFalse($contributor->has_cap('delete_page', $page)); 660 661 // administrators, editors, and authors can publish it 662 $this->assertTrue($admin->has_cap('publish_page', $page)); 663 $this->assertTrue($editor->has_cap('publish_page', $page)); 664 $this->assertTrue($author->has_cap('publish_page', $page)); 665 $this->assertTrue($author_2->has_cap('publish_page', $page)); 666 // contributors can't 667 $this->assertFalse($contributor->has_cap('publish_page', $page)); 652 668 } 653 669 654 670 /**