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/getComments.php

    r35242 r40417  
    99    function test_invalid_username_password() {
    1010        $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'username', 'password', array() ) );
    11         $this->assertInstanceOf( 'IXR_Error', $result );
     11        $this->assertIXRError( $result );
    1212        $this->assertEquals( 403, $result->code );
    1313    }
     
    1717
    1818        $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'contributor', 'contributor', array() ) );
    19         $this->assertInstanceOf( 'IXR_Error', $result );
     19        $this->assertIXRError( $result );
    2020        $this->assertEquals( 401, $result->code );
    2121    }
     
    2828
    2929        $results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', array() ) );
    30         $this->assertNotInstanceOf( 'IXR_Error', $results );
     30        $this->assertNotIXRError( $results );
    3131
    3232        foreach( $results as $result ) {
     
    4545            'post_id' => $this->post_id
    4646        ) ) );
    47         $this->assertNotInstanceOf( 'IXR_Error', $results );
     47        $this->assertNotIXRError( $results );
    4848
    4949        foreach( $results as $result ) {
     
    6161            'post_id' => $this->post_id,
    6262        ) ) );
    63         $this->assertNotInstanceOf( 'IXR_Error', $results );
     63        $this->assertNotIXRError( $results );
    6464
    6565        // if no 'number' filter is specified, default should be 10
     
    7070            'number' => 5
    7171        ) ) );
    72         $this->assertNotInstanceOf( 'IXR_Error', $results2 );
     72        $this->assertNotIXRError( $results2 );
    7373        $this->assertCount( 5, $results2 );
    7474    }
     
    105105
    106106        $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'contributor', 'contributor' ) );
    107         $this->assertInstanceOf( 'IXR_Error', $result );
     107        $this->assertIXRError( $result );
    108108        $this->assertEquals( 401, $result->code );
    109109    }
     
    141141            'post_id' => $author_post_id
    142142        ) ) );
    143         $this->assertInstanceOf( 'IXR_Error', $result1 );
     143        $this->assertIXRError( $result1 );
    144144
    145145        $result2 = $this->myxmlrpcserver->wp_getComments( array( 1, 'author', 'author', array(
     
    154154            'post_id' => $editor_post_id
    155155        ) ) );
    156         $this->assertInstanceOf( 'IXR_Error', $result3 );
     156        $this->assertIXRError( $result3 );
    157157
    158158        $result4 = $this->myxmlrpcserver->wp_getComments( array( 1, 'author', 'author', array(
Note: See TracChangeset for help on using the changeset viewer.