Make WordPress Core

Changeset 50926


Ignore:
Timestamp:
05/18/2021 09:04:31 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertInstanceOf() instead of assertTrue() in some tests.

See #52625.

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

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php

    r50463 r50926  
    111111                remove_filter( 'locale', array( $this, 'filter_set_locale_to_german' ) );
    112112
    113                 $this->assertTrue( $translations instanceof NOOP_Translations );
     113                $this->assertInstanceOf( 'NOOP_Translations', $translations );
    114114        }
    115115
  • trunk/tests/phpunit/tests/term/cache.php

    r48939 r50926  
    434434                $term = get_term_by( 'name', 'Burrito', 'post_tag' );
    435435                $num_queries++;
    436                 $this->assertTrue( $term instanceof WP_Term );
     436                $this->assertInstanceOf( 'WP_Term', $term );
    437437                $this->assertSame( $term_id, $term->term_id );
    438438                $this->assertSame( $num_queries, $wpdb->num_queries );
  • trunk/tests/phpunit/tests/term/getTerm.php

    r48937 r50926  
    136136                $found = get_term( $term_data );
    137137
    138                 $this->assertTrue( $found instanceof WP_Term );
     138                $this->assertInstanceOf( 'WP_Term', $found );
    139139                $this->assertInternalType( 'int', $found->term_id );
    140140                $this->assertInternalType( 'int', $found->term_taxonomy_id );
  • trunk/tests/phpunit/tests/term/getTermBy.php

    r48937 r50926  
    126126                $num_queries++;
    127127
    128                 $this->assertTrue( $found instanceof WP_Term );
     128                $this->assertInstanceOf( 'WP_Term', $found );
    129129                $this->assertSame( $t, $found->term_id );
    130130                $this->assertSame( $num_queries, $wpdb->num_queries );
    … …  
    152152                $found = get_term_by( 'name', $term_name_slashed, 'wptests_tax' );
    153153
    154                 $this->assertTrue( $found instanceof WP_Term );
     154                $this->assertInstanceOf( 'WP_Term', $found );
    155155                $this->assertSame( $t, $found->term_id );
    156156                $this->assertSame( $term_name, $found->name );
    … …  
    172172                $found1 = get_term_by( 'slug', 'foo foo', 'wptests_tax' );
    173173
    174                 $this->assertTrue( $found1 instanceof WP_Term );
     174                $this->assertInstanceOf( 'WP_Term', $found1 );
    175175                $this->assertSame( $t1, $found1->term_id );
    176176
    … …  
    185185                $found2 = get_term_by( 'slug', '仪表盘', 'wptests_tax' );
    186186
    187                 $this->assertTrue( $found2 instanceof WP_Term );
     187                $this->assertInstanceOf( 'WP_Term', $found2 );
    188188                $this->assertSame( $t2, $found2->term_id );
    189189        }
  • trunk/tests/phpunit/tests/user/updateUserCaches.php

    r48937 r50926  
    6565
    6666                $cached = wp_cache_get( $u, 'users' );
    67                 $this->assertFalse( $cached instanceof WP_User );
     67                $this->assertNotInstanceOf( 'WP_User', $cached );
    6868                $this->assertEquals( $raw_userdata, $cached );
    6969        }
Note: See TracChangeset for help on using the changeset viewer.