WordPress.org

Make WordPress Core

Changeset 1160 in tests


Ignore:
Timestamp:
11/29/12 16:04:21 (17 months ago)
Author:
nacin
Message:

Basic tests for the attachment post type having a different capability for create_posts than edit_posts. see #WP16714.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/user/capabilities.php

    r1159 r1160  
    561561        $cap = get_post_type_object( 'foobar' )->cap; 
    562562 
     563        $this->assertEquals( 'edit_foobars', $cap->create_posts ); 
     564 
    563565        $this->assertFalse($admin->has_cap( $cap->create_posts )); 
    564566        $this->assertFalse($author->has_cap( $cap->create_posts )); 
     
    577579 
    578580        _unregister_post_type( 'foobar' ); 
     581 
     582        $cap = get_post_type_object( 'attachment' )->cap; 
     583        $this->assertEquals( 'upload_files', $cap->create_posts ); 
     584        $this->assertEquals( 'edit_posts', $cap->edit_posts ); 
     585 
     586        $this->assertTrue( $author->has_cap( $cap->create_posts ) ); 
     587        $this->assertTrue( $author->has_cap( $cap->edit_posts ) ); 
     588        $this->assertTrue( $contributor->has_cap( $cap->edit_posts ) ); 
     589        $this->assertFalse( $contributor->has_cap( $cap->create_posts ) ); 
    579590    } 
    580591 
Note: See TracChangeset for help on using the changeset viewer.