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/includes/testcase.php

    r40416 r40417  
    437437        }
    438438        $this->assertNotInstanceOf( 'WP_Error', $actual, $message );
     439    }
     440
     441    function assertIXRError( $actual, $message = '' ) {
     442        $this->assertInstanceOf( 'IXR_Error', $actual, $message );
     443    }
     444
     445    function assertNotIXRError( $actual, $message = '' ) {
     446        if ( $actual instanceof IXR_Error && '' === $message ) {
     447            $message = $actual->message;
     448        }
     449        $this->assertNotInstanceOf( 'IXR_Error', $actual, $message );
    439450    }
    440451
Note: See TracChangeset for help on using the changeset viewer.