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

    r38078 r40417  
    88    function test_invalid_username_password() {
    99        $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'username', 'password', 'category' ) );
    10         $this->assertInstanceOf( 'IXR_Error', $result );
     10        $this->assertIXRError( $result );
    1111        $this->assertEquals( 403, $result->code );
    1212    }
     
    1616
    1717        $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', '' ) );
    18         $this->assertInstanceOf( 'IXR_Error', $result );
     18        $this->assertIXRError( $result );
    1919        $this->assertEquals( 403, $result->code );
    2020        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    2525
    2626        $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'not_existing' ) );
    27         $this->assertInstanceOf( 'IXR_Error', $result );
     27        $this->assertIXRError( $result );
    2828        $this->assertEquals( 403, $result->code );
    2929        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    3434
    3535        $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', 'category' ) );
    36         $this->assertInstanceOf( 'IXR_Error', $result );
     36        $this->assertIXRError( $result );
    3737        $this->assertEquals( 401, $result->code );
    3838        $this->assertEquals( __( 'Sorry, you are not allowed to assign terms in this taxonomy.' ), $result->message );
     
    4343
    4444        $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
    45         $this->assertNotInstanceOf( 'IXR_Error', $result );
     45        $this->assertNotIXRError( $result );
    4646    }
    4747
     
    5050
    5151        $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
    52         $this->assertNotInstanceOf( 'IXR_Error', $result );
     52        $this->assertNotIXRError( $result );
    5353        $taxonomy = get_taxonomy( 'category' );
    5454        $this->assertEquals( 'category', $result['name'], 'name' );
Note: See TracChangeset for help on using the changeset viewer.