Passing non-existent object properties to WP_UnitTestCase::assertNull()
produces notices, opt instead for WP_UnitTestCase::assertTrue( empty( $obj->prop ) )
in tests/db.php
.
See #25282. git-svn-id: https://develop.svn.wordpress.org/trunk@25374 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
85881c19dc
commit
591a96743e
@ -98,7 +98,7 @@ class Tests_DB extends WP_UnitTestCase {
|
|||||||
$this->assertNotEmpty( $dbh );
|
$this->assertNotEmpty( $dbh );
|
||||||
$this->assertTrue( isset( $wpdb->dbh ) ); // Test __isset()
|
$this->assertTrue( isset( $wpdb->dbh ) ); // Test __isset()
|
||||||
unset( $wpdb->dbh );
|
unset( $wpdb->dbh );
|
||||||
$this->assertNull( $wpdb->dbh );
|
$this->assertTrue( empty( $wpdb->dbh ) );
|
||||||
$wpdb->dbh = $dbh;
|
$wpdb->dbh = $dbh;
|
||||||
$this->assertNotEmpty( $wpdb->dbh );
|
$this->assertNotEmpty( $wpdb->dbh );
|
||||||
}
|
}
|
||||||
@ -109,12 +109,12 @@ class Tests_DB extends WP_UnitTestCase {
|
|||||||
function test_wpdb_nonexistent_properties() {
|
function test_wpdb_nonexistent_properties() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$this->assertNull( $wpdb->nonexistent_property );
|
$this->assertTrue( empty( $wpdb->nonexistent_property ) );
|
||||||
$wpdb->nonexistent_property = true;
|
$wpdb->nonexistent_property = true;
|
||||||
$this->assertTrue( $wpdb->nonexistent_property );
|
$this->assertTrue( $wpdb->nonexistent_property );
|
||||||
$this->assertTrue( isset( $wpdb->nonexistent_property ) );
|
$this->assertTrue( isset( $wpdb->nonexistent_property ) );
|
||||||
unset( $wpdb->nonexistent_property );
|
unset( $wpdb->nonexistent_property );
|
||||||
$this->assertNull( $wpdb->nonexistent_property );
|
$this->assertTrue( empty( $wpdb->nonexistent_property ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user