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

    r39189 r40417  
    1616    function test_invalid_username_password() {
    1717        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'username', 'password', 'category', 1 ) );
    18         $this->assertInstanceOf( 'IXR_Error', $result );
     18        $this->assertIXRError( $result );
    1919        $this->assertEquals( 403, $result->code );
    2020    }
     
    2424
    2525        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', '', 0 ) );
    26         $this->assertInstanceOf( 'IXR_Error', $result );
     26        $this->assertIXRError( $result );
    2727        $this->assertEquals( 403, $result->code );
    2828        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    3333
    3434        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'not_existing', 0 ) );
    35         $this->assertInstanceOf( 'IXR_Error', $result );
     35        $this->assertIXRError( $result );
    3636        $this->assertEquals( 403, $result->code );
    3737        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    4242
    4343        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'subscriber', 'subscriber', 'category', self::$term_id ) );
    44         $this->assertInstanceOf( 'IXR_Error', $result );
     44        $this->assertIXRError( $result );
    4545        $this->assertEquals( 401, $result->code );
    4646        $this->assertEquals( __( 'Sorry, you are not allowed to assign this term.' ), $result->message );
     
    5252
    5353        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', '' ) );
    54         $this->assertInstanceOf( 'IXR_Error', $result );
     54        $this->assertIXRError( $result );
    5555        $this->assertEquals( 500, $result->code );
    5656        $this->assertEquals( __('Empty Term'), $result->message );
     
    6161
    6262        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
    63         $this->assertInstanceOf( 'IXR_Error', $result );
     63        $this->assertIXRError( $result );
    6464        $this->assertEquals( 404, $result->code );
    6565        $this->assertEquals( __( 'Invalid term ID.' ), $result->message );
     
    7373        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', self::$term_id ) );
    7474
    75         $this->assertNotInstanceOf( 'IXR_Error', $result );
     75        $this->assertNotIXRError( $result );
    7676        $this->assertEquals( $result, $term );
    7777
Note: See TracChangeset for help on using the changeset viewer.