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/mw/getPost.php

    r39189 r40417  
    2020    function test_invalid_username_password() {
    2121        $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'username', 'password' ) );
    22         $this->assertInstanceOf( 'IXR_Error', $result );
     22        $this->assertIXRError( $result );
    2323        $this->assertEquals( 403, $result->code );
    2424    }
     
    2828
    2929        $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'subscriber', 'subscriber' ) );
    30         $this->assertInstanceOf( 'IXR_Error', $result );
     30        $this->assertIXRError( $result );
    3131        $this->assertEquals( 401, $result->code );
    3232    }
     
    3737    function test_invalid_postid() {
    3838        $result = $this->myxmlrpcserver->mw_getPost( array( 9999, 'author', 'author' ) );
    39         $this->assertInstanceOf( 'IXR_Error', $result );
     39        $this->assertIXRError( $result );
    4040        $this->assertEquals( 404, $result->code );
    4141    }
     
    4646        $fields = array( 'post' );
    4747        $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'author', 'author' ) );
    48         $this->assertNotInstanceOf( 'IXR_Error', $result );
     48        $this->assertNotIXRError( $result );
    4949
    5050        // Check data types
     
    9797        $fields = array( 'post' );
    9898        $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'author', 'author' ) );
    99         $this->assertNotInstanceOf( 'IXR_Error', $result );
     99        $this->assertNotIXRError( $result );
    100100
    101101        $this->assertInternalType( 'string', $result['wp_post_thumbnail'] );
     
    109109        $fields = array( 'post' );
    110110        $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'author', 'author' ) );
    111         $this->assertNotInstanceOf( 'IXR_Error', $result );
     111        $this->assertNotIXRError( $result );
    112112
    113113        $this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
Note: See TracChangeset for help on using the changeset viewer.