Tests: Use more appropriate assertions in various tests.

This replaces instances of `assertTrue( is_a( ... ) )` with `assertInstanceOf()` to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397], [51403], [51404].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51436 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2021-07-15 09:06:20 +00:00
parent f17f4f5f7e
commit cc5e3f7811
4 changed files with 4 additions and 4 deletions

View File

@@ -29,7 +29,7 @@ abstract class WP_Filesystem_UnitTestCase extends WP_UnitTestCase {
function test_is_MockFS_sane() {
global $wp_filesystem;
$this->assertTrue( is_a( $wp_filesystem, 'WP_Filesystem_MockFS' ) );
$this->assertInstanceOf( 'WP_Filesystem_MockFS', $wp_filesystem );
$wp_filesystem->init( '/' );

View File

@@ -102,7 +102,7 @@ class Tests_Post_Query extends WP_UnitTestCase {
foreach ( $query->posts as $post ) {
// Posts are WP_Post objects.
$this->assertTrue( is_a( $post, 'WP_Post' ) );
$this->assertInstanceOf( 'WP_Post', $post );
// Filters are raw.
$this->assertSame( 'raw', $post->filter );

View File

@@ -55,7 +55,7 @@ class Test_Sitemaps_Functions extends WP_UnitTestCase {
$this->assertSame( array_keys( $expected ), array_keys( $sitemaps ), 'Unable to confirm default sitemap types are registered.' );
foreach ( $expected as $name => $provider ) {
$this->assertTrue( is_a( $sitemaps[ $name ], $provider ), "Default $name sitemap is not a $provider object." );
$this->assertInstanceOf( $provider, $sitemaps[ $name ], "Default $name sitemap is not a $provider object." );
}
}

View File

@@ -438,7 +438,7 @@ class Tests_Taxonomy extends WP_UnitTestCase {
'taxonomy' => 'force_error',
'cat_name' => 'Error',
);
$this->assertTrue( is_a( wp_insert_category( $cat, true ), 'WP_Error' ) );
$this->assertInstanceOf( 'WP_Error', wp_insert_category( $cat, true ) );
}
function test_insert_category_force_error_no_handle() {