Make WordPress Core

Ticket #17253: test-author-capabilities.diff

File test-author-capabilities.diff, 811 bytes (added by knutsp, 11 years ago)

Test that new authors get new capabilities

  • capabilities.php

     
    741741                $user->remove_cap( 'publish_pages' );
    742742                $this->assertFalse( $user->has_cap( 'publish_pages' ) );
    743743        }
     744
     745        /**
     746         * @ticket 17253
     747         */
     748        function test_extra_author_caps() {
     749                $author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
     750                wp_set_current_user( $author->ID );
     751
     752                $this->assertTrue( $user->has_cap( 'edit_pages' ) );
     753                $this->assertTrue( $user->has_cap( 'publish_pages' ) );
     754                $this->assertTrue( $user->has_cap( 'edit_published_pages' ) );
     755                $this->assertTrue( $user->has_cap( 'delete_pages' ) );
     756                $this->assertTrue( $user->has_cap( 'delete_published_pages' ) );
     757        }
    744758}