Make WordPress Core


Ignore:
Timestamp:
04/12/2017 02:58:33 PM (9 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/getPost.php

    r35242 r40417  
    2828        function test_invalid_username_password() {
    2929                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'username', 'password', 1 ) );
    30                 $this->assertInstanceOf( 'IXR_Error', $result );
     30                $this->assertIXRError( $result );
    3131                $this->assertEquals( 403, $result->code );
    3232        }
     
    3737                $fields = array( 'post', 'custom_fields' );
    3838                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
    39                 $this->assertNotInstanceOf( 'IXR_Error', $result );
     39                $this->assertNotIXRError( $result );
    4040
    4141                // Check data types
     
    8080                $fields = array();
    8181                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
    82                 $this->assertNotInstanceOf( 'IXR_Error', $result );
     82                $this->assertNotIXRError( $result );
    8383
    8484                // when no fields are requested, only the IDs should be returned
     
    8989        function test_default_fields() {
    9090                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id ) );
    91                 $this->assertNotInstanceOf( 'IXR_Error', $result );
     91                $this->assertNotIXRError( $result );
    9292
    9393                $this->assertArrayHasKey( 'post_id', $result );
     
    100100                $fields = array( 'post' );
    101101                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
    102                 $this->assertNotInstanceOf( 'IXR_Error', $result );
     102                $this->assertNotIXRError( $result );
    103103
    104104                $this->assertInstanceOf( 'IXR_Date', $result['post_date'] );
     
    131131
    132132                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'editor', 'editor', $child_page_id ) );
    133                 $this->assertNotInstanceOf( 'IXR_Error', $result );
     133                $this->assertNotIXRError( $result );
    134134
    135135                $this->assertInternalType( 'string', $result['post_id'] );
Note: See TracChangeset for help on using the changeset viewer.