Make WordPress Core

Changeset 34638


Ignore:
Timestamp:
09/27/2015 09:28:26 PM (11 years ago)
Author:
johnbillion
Message:

Introduce WP_UnitTestCase::assertNotWPError() for when a test needs to assert that something is, well, not a WP_Error.

See #33978

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase.php

    r32953 r34638  
    300300        function assertWPError( $actual, $message = '' ) {
    301301                $this->assertInstanceOf( 'WP_Error', $actual, $message );
     302        }
     303
     304        function assertNotWPError( $actual, $message = '' ) {
     305                if ( is_wp_error( $actual ) && '' === $message ) {
     306                        $message = $actual->get_error_message();
     307                }
     308                $this->assertNotInstanceOf( 'WP_Error', $actual, $message );
    302309        }
    303310
Note: See TracChangeset for help on using the changeset viewer.