Introduce WP_UnitTestCase::assertNotWPError()
for when a test needs to assert that something is, well, not a WP_Error
.
See #33978 git-svn-id: https://develop.svn.wordpress.org/trunk@34638 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
deb42cc66f
commit
5ff16465f2
@ -301,6 +301,13 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||
$this->assertInstanceOf( 'WP_Error', $actual, $message );
|
||||
}
|
||||
|
||||
function assertNotWPError( $actual, $message = '' ) {
|
||||
if ( is_wp_error( $actual ) && '' === $message ) {
|
||||
$message = $actual->get_error_message();
|
||||
}
|
||||
$this->assertNotInstanceOf( 'WP_Error', $actual, $message );
|
||||
}
|
||||
|
||||
function assertEqualFields( $object, $fields ) {
|
||||
foreach( $fields as $field_name => $field_value ) {
|
||||
if ( $object->$field_name != $field_value ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user