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

    r38938 r40417  
    2626    function test_invalid_username_password() {
    2727        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'username', 'password', 1 ) );
    28         $this->assertInstanceOf( 'IXR_Error', $result );
     28        $this->assertIXRError( $result );
    2929        $this->assertEquals( 403, $result->code );
    3030    }
     
    3232    function test_invalid_user() {
    3333        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', 34902348908234 ) );
    34         $this->assertInstanceOf( 'IXR_Error', $result );
     34        $this->assertIXRError( $result );
    3535        $this->assertEquals( 404, $result->code );
    3636    }
     
    4141
    4242        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'subscriber', 'subscriber', $editor_id ) );
    43         $this->assertInstanceOf( 'IXR_Error', $result );
     43        $this->assertIXRError( $result );
    4444        $this->assertEquals( 401, $result->code );
    4545    }
     
    4949
    5050        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'subscriber', 'subscriber', $subscriber_id ) );
    51         $this->assertNotInstanceOf( 'IXR_Error', $result );
     51        $this->assertNotIXRError( $result );
    5252        $this->assertEquals( $subscriber_id, $result['user_id'] );
    5353    }
     
    7373
    7474        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $user_id ) );
    75         $this->assertNotInstanceOf( 'IXR_Error', $result );
     75        $this->assertNotIXRError( $result );
    7676
    7777        // check data types
     
    112112
    113113        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, array() ) );
    114         $this->assertNotInstanceOf( 'IXR_Error', $result );
     114        $this->assertNotIXRError( $result );
    115115        $this->assertEquals( $editor_id, $result['user_id'] );
    116116
     
    123123
    124124        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, array( 'basic' ) ) );
    125         $this->assertNotInstanceOf( 'IXR_Error', $result );
     125        $this->assertNotIXRError( $result );
    126126        $this->assertEquals( $editor_id, $result['user_id'] );
    127127
     
    139139
    140140        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, $fields ) );
    141         $this->assertNotInstanceOf( 'IXR_Error', $result );
     141        $this->assertNotIXRError( $result );
    142142        $this->assertEquals( $editor_id, $result['user_id'] );
    143143
Note: See TracChangeset for help on using the changeset viewer.