Make WordPress Core

Changeset 51436


Ignore:
Timestamp:
07/15/2021 09:06:20 AM (3 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/tests/phpunit/tests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/filesystem/base.php

    r47198 r51436  
    3030    function test_is_MockFS_sane() {
    3131        global $wp_filesystem;
    32         $this->assertTrue( is_a( $wp_filesystem, 'WP_Filesystem_MockFS' ) );
     32        $this->assertInstanceOf( 'WP_Filesystem_MockFS', $wp_filesystem );
    3333
    3434        $wp_filesystem->init( '/' );
  • trunk/tests/phpunit/tests/post/query.php

    r51367 r51436  
    103103
    104104            // Posts are WP_Post objects.
    105             $this->assertTrue( is_a( $post, 'WP_Post' ) );
     105            $this->assertInstanceOf( 'WP_Post', $post );
    106106
    107107            // Filters are raw.
  • trunk/tests/phpunit/tests/sitemaps/functions.php

    r50491 r51436  
    5656
    5757        foreach ( $expected as $name => $provider ) {
    58             $this->assertTrue( is_a( $sitemaps[ $name ], $provider ), "Default $name sitemap is not a $provider object." );
     58            $this->assertInstanceOf( $provider, $sitemaps[ $name ], "Default $name sitemap is not a $provider object." );
    5959        }
    6060    }
  • trunk/tests/phpunit/tests/taxonomy.php

    r51397 r51436  
    439439            'cat_name' => 'Error',
    440440        );
    441         $this->assertTrue( is_a( wp_insert_category( $cat, true ), 'WP_Error' ) );
     441        $this->assertInstanceOf( 'WP_Error', wp_insert_category( $cat, true ) );
    442442    }
    443443
Note: See TracChangeset for help on using the changeset viewer.