WordPress.org

Make WordPress Core

Changeset 1022 in tests


Ignore:
Timestamp:
09/17/12 19:52:30 (22 months ago)
Author:
maxcutler
Message:

XMLRPC: Fixed broken 'wp.getUser' tests in multisite mode.

Some user cap behaviors change when in multisite mode, so tests were
changed to create super-admin user when necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/xmlrpc/wp/getUser.php

    r1016 r1022  
    66 */ 
    77class TestXMLRPCServer_wp_getUser extends WP_XMLRPC_UnitTestCase { 
     8    protected $administrator_id; 
     9 
     10    function setUp() { 
     11        parent::setUp(); 
     12 
     13        // create a super-admin 
     14        $this->administrator_id = $this->make_user_by_role( 'administrator' ); 
     15        if ( is_multisite() ) 
     16            grant_super_admin( $this->administrator_id ); 
     17    } 
     18 
     19    function tearDown() { 
     20        if ( is_multisite() ) 
     21            revoke_super_admin( $this->administrator_id ); 
     22 
     23        parent::tearDown(); 
     24    } 
    825 
    926    function test_invalid_username_password() { 
     
    1431 
    1532    function test_invalid_user() { 
    16         $this->make_user_by_role( 'administrator' ); 
    17  
    1833        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', 34902348908234 ) ); 
    1934        $this->assertInstanceOf( 'IXR_Error', $result ); 
     
    3954 
    4055    function test_valid_user() { 
    41         $this->make_user_by_role( 'administrator' ); 
    42  
    4356        $registered_date = strtotime( '-1 day' ); 
    4457        $user_data = array( 
     
    97110    function test_no_fields() { 
    98111        $editor_id = $this->make_user_by_role( 'editor' ); 
    99         $this->make_user_by_role( 'administrator' ); 
    100112 
    101113        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, array() ) ); 
     
    109121    function test_basic_fields() { 
    110122        $editor_id = $this->make_user_by_role( 'editor' ); 
    111         $this->make_user_by_role( 'administrator' ); 
    112123 
    113124        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, array( 'basic' ) ) ); 
     
    121132    function test_arbitrary_fields() { 
    122133        $editor_id = $this->make_user_by_role( 'editor' ); 
    123         $this->make_user_by_role( 'administrator' ); 
    124134 
    125135        $fields = array( 'email', 'bio', 'user_contacts' ); 
Note: See TracChangeset for help on using the changeset viewer.