Make WordPress Core


Ignore:
Timestamp:
04/12/2017 02:58:33 PM (7 years ago)
Author:
johnbillion
Message:

Build/Test tools: Introduce and implement assertNotIXRError() and assertIXRError() assertion methods.

This aids in debugging XMLRPC tests which fail, by exposing the IXR_Error error message in the assertion failure message.

Fixes #40423

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/xmlrpc/wp/getUsers.php

    r38938 r40417  
    99    function test_invalid_username_password() {
    1010        $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'username', 'password' ) );
    11         $this->assertInstanceOf( 'IXR_Error', $results );
     11        $this->assertIXRError( $results );
    1212        $this->assertEquals( 403, $results->code );
    1313    }
     
    1717
    1818        $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'subscriber', 'subscriber' ) );
    19         $this->assertInstanceOf( 'IXR_Error', $results );
     19        $this->assertIXRError( $results );
    2020        $this->assertEquals( 401, $results->code );
    2121    }
     
    2525
    2626        $result = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator' ) );
    27         $this->assertNotInstanceOf( 'IXR_Error', $result );
     27        $this->assertNotIXRError( $result );
    2828
    2929        // check data types
     
    5050        $filter = array( 'role' => 'invalidrole' );
    5151        $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) );
    52         $this->assertInstanceOf( 'IXR_Error', $results );
     52        $this->assertIXRError( $results );
    5353        $this->assertEquals( 403, $results->code );
    5454    }
     
    6464        $filter = array( 'role' => 'editor' );
    6565        $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) );
    66         $this->assertNotInstanceOf( 'IXR_Error', $results );
     66        $this->assertNotIXRError( $results );
    6767        $this->assertCount( 1, $results );
    6868        $this->assertEquals( $editor_id, $results[0]['user_id'] );
     
    7171        $filter2 = array( 'who' => 'authors' );
    7272        $results2 = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter2 ) );
    73         $this->assertNotInstanceOf( 'IXR_Error', $results2 );
     73        $this->assertNotIXRError( $results2 );
    7474        $this->assertCount( 3, array_intersect( array( $author_id, $editor_id, $administrator_id ), wp_list_pluck( $results2, 'user_id' ) ) );
    7575    }
     
    105105        $filter = array( 'orderby' => 'email', 'order' => 'ASC' );
    106106        $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) );
    107         $this->assertNotInstanceOf( 'IXR_Error', $results );
     107        $this->assertNotIXRError( $results );
    108108
    109109        $last_email = '';
Note: See TracChangeset for help on using the changeset viewer.