Changeset 47178 for trunk/tests/phpunit/tests/user/capabilities.php
- Timestamp:
- 02/04/2020 10:13:15 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/capabilities.php
r47122 r47178 1775 1775 1776 1776 /** 1777 * @ticket 48653 1778 * @expectedIncorrectUsage map_meta_cap 1779 */ 1780 function test_require_edit_others_posts_if_post_status_doesnt_exist() { 1781 register_post_status( 'existed' ); 1782 $post_id = self::factory()->post->create( array( 'post_status' => 'existed' ) ); 1783 _unregister_post_status( 'existed' ); 1784 1785 $subscriber_id = self::$users['subscriber']->ID; 1786 $editor_id = self::$users['editor']->ID; 1787 1788 foreach ( array( 'read_post', 'read_page' ) as $cap ) { 1789 wp_set_current_user( $subscriber_id ); 1790 $this->assertSame( array( 'edit_others_posts' ), map_meta_cap( $cap, $subscriber_id, $post_id ) ); 1791 $this->assertFalse( current_user_can( $cap, $post_id ) ); 1792 1793 wp_set_current_user( $editor_id ); 1794 $this->assertSame( array( 'edit_others_posts' ), map_meta_cap( $cap, $editor_id, $post_id ) ); 1795 $this->assertTrue( current_user_can( $cap, $post_id ) ); 1796 } 1797 } 1798 1799 /** 1777 1800 * @ticket 17253 1778 1801 */
Note: See TracChangeset
for help on using the changeset viewer.