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

    r39189 r40417  
    1515    function test_invalid_username_password() {
    1616        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'username', 'password', 'category', 0 ) );
    17         $this->assertInstanceOf( 'IXR_Error', $result );
     17        $this->assertIXRError( $result );
    1818        $this->assertEquals( 403, $result->code );
    1919    }
     
    2323
    2424        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', '', 0 ) );
    25         $this->assertInstanceOf( 'IXR_Error', $result );
     25        $this->assertIXRError( $result );
    2626        $this->assertEquals( 403, $result->code );
    2727        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    3232
    3333        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'not_existing', 0 ) );
    34         $this->assertInstanceOf( 'IXR_Error', $result );
     34        $this->assertIXRError( $result );
    3535        $this->assertEquals( 403, $result->code );
    3636        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    4141
    4242        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'category', self::$term_id ) );
    43         $this->assertInstanceOf( 'IXR_Error', $result );
     43        $this->assertIXRError( $result );
    4444        $this->assertEquals( 401, $result->code );
    4545        $this->assertEquals( __( 'Sorry, you are not allowed to delete this term.' ), $result->message );
     
    5050
    5151        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', '' ) );
    52         $this->assertInstanceOf( 'IXR_Error', $result );
     52        $this->assertIXRError( $result );
    5353        $this->assertEquals( 500, $result->code );
    5454        $this->assertEquals( __('Empty Term'), $result->message );
     
    5959
    6060        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
    61         $this->assertInstanceOf( 'IXR_Error', $result );
     61        $this->assertIXRError( $result );
    6262        $this->assertEquals( 404, $result->code );
    6363        $this->assertEquals( __( 'Invalid term ID.' ), $result->message );
     
    6868
    6969        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', self::$term_id ) );
    70         $this->assertNotInstanceOf( 'IXR_Error', $result );
     70        $this->assertNotIXRError( $result );
    7171        $this->assertInternalType( 'boolean', $result );
    7272    }
Note: See TracChangeset for help on using the changeset viewer.