From 2a73ddeab0b4f4b8048f07303e0e3cc8d7845a69 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 6 Jul 2021 12:31:19 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/post/nav-menu.php | 8 ++++---- tests/phpunit/tests/taxonomy.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/phpunit/tests/post/nav-menu.php b/tests/phpunit/tests/post/nav-menu.php index 3f82ed999c..3153853159 100644 --- a/tests/phpunit/tests/post/nav-menu.php +++ b/tests/phpunit/tests/post/nav-menu.php @@ -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; } diff --git a/tests/phpunit/tests/taxonomy.php b/tests/phpunit/tests/taxonomy.php index d008840238..803419bf32 100644 --- a/tests/phpunit/tests/taxonomy.php +++ b/tests/phpunit/tests/taxonomy.php @@ -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 ); }