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:
Scott Taylor 2013-09-12 04:01:34 +00:00
parent 85881c19dc
commit 591a96743e
1 changed files with 3 additions and 3 deletions

View File

@ -98,7 +98,7 @@ class Tests_DB extends WP_UnitTestCase {
$this->assertNotEmpty( $dbh );
$this->assertTrue( isset( $wpdb->dbh ) ); // Test __isset()
unset( $wpdb->dbh );
$this->assertNull( $wpdb->dbh );
$this->assertTrue( empty( $wpdb->dbh ) );
$wpdb->dbh = $dbh;
$this->assertNotEmpty( $wpdb->dbh );
}
@ -109,12 +109,12 @@ class Tests_DB extends WP_UnitTestCase {
function test_wpdb_nonexistent_properties() {
global $wpdb;
$this->assertNull( $wpdb->nonexistent_property );
$this->assertTrue( empty( $wpdb->nonexistent_property ) );
$wpdb->nonexistent_property = true;
$this->assertTrue( $wpdb->nonexistent_property );
$this->assertTrue( isset( $wpdb->nonexistent_property ) );
unset( $wpdb->nonexistent_property );
$this->assertNull( $wpdb->nonexistent_property );
$this->assertTrue( empty( $wpdb->nonexistent_property ) );
}
/**