Tests: Use more appropriate assertions in various tests.

This replaces instances of `assertTrue( is_object( ... ) )` with `assertIsObject()` to use native PHPUnit functionality.

Follow-up to [51331], [51335].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51337 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2021-07-06 12:31:19 +00:00
parent 24479f2141
commit 2a73ddeab0
2 changed files with 6 additions and 6 deletions

View File

@@ -551,22 +551,22 @@ class Tests_Post_Nav_Menu extends WP_UnitTestCase {
* Run tests required to confrim Walker_Nav_Menu receives an $args object.
*/
function _confirm_nav_menu_item_args_object( $args ) {
$this->assertTrue( is_object( $args ) );
$this->assertIsObject( $args );
return $args;
}
function _confirm_second_param_args_object( $ignored_1, $args ) {
$this->assertTrue( is_object( $args ) );
$this->assertIsObject( $args );
return $ignored_1;
}
function _confirm_third_param_args_object( $ignored_1, $ignored_2, $args ) {
$this->assertTrue( is_object( $args ) );
$this->assertIsObject( $args );
return $ignored_1;
}
function _confirm_forth_param_args_object( $ignored_1, $ignored_2, $ignored_3, $args ) {
$this->assertTrue( is_object( $args ) );
$this->assertIsObject( $args );
return $ignored_1;
}

View File

@@ -27,7 +27,7 @@ class Tests_Taxonomy extends WP_UnitTestCase {
foreach ( get_object_taxonomies( 'post' ) as $taxonomy ) {
$tax = get_taxonomy( $taxonomy );
// Should return an object with the correct taxonomy object type.
$this->assertTrue( is_object( $tax ) );
$this->assertIsObject( $tax );
$this->assertIsArray( $tax->object_type );
$this->assertSame( array( 'post' ), $tax->object_type );
}
@@ -109,7 +109,7 @@ class Tests_Taxonomy extends WP_UnitTestCase {
foreach ( get_object_taxonomies( 'link' ) as $taxonomy ) {
$tax = get_taxonomy( $taxonomy );
// Should return an object with the correct taxonomy object type.
$this->assertTrue( is_object( $tax ) );
$this->assertIsObject( $tax );
$this->assertIsArray( $tax->object_type );
$this->assertSame( array( 'link' ), $tax->object_type );
}