mirror of
git://develop.git.wordpress.org/
synced 2025-04-13 08:32:10 +02:00
Tests: Use assertInstanceOf()
instead of assertTrue()
in some tests.
See #52625. git-svn-id: https://develop.svn.wordpress.org/trunk@50926 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
00824d128a
commit
fe9ab38075
@ -110,7 +110,7 @@ class Tests_L10n_LoadTextdomainJustInTime extends WP_UnitTestCase {
|
||||
remove_filter( 'override_load_textdomain', '__return_true' );
|
||||
remove_filter( 'locale', array( $this, 'filter_set_locale_to_german' ) );
|
||||
|
||||
$this->assertTrue( $translations instanceof NOOP_Translations );
|
||||
$this->assertInstanceOf( 'NOOP_Translations', $translations );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -433,7 +433,7 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
|
||||
$term = get_term_by( 'name', 'Burrito', 'post_tag' );
|
||||
$num_queries++;
|
||||
$this->assertTrue( $term instanceof WP_Term );
|
||||
$this->assertInstanceOf( 'WP_Term', $term );
|
||||
$this->assertSame( $term_id, $term->term_id );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
|
||||
|
@ -135,7 +135,7 @@ class Tests_Term_GetTerm extends WP_UnitTestCase {
|
||||
|
||||
$found = get_term( $term_data );
|
||||
|
||||
$this->assertTrue( $found instanceof WP_Term );
|
||||
$this->assertInstanceOf( 'WP_Term', $found );
|
||||
$this->assertInternalType( 'int', $found->term_id );
|
||||
$this->assertInternalType( 'int', $found->term_taxonomy_id );
|
||||
$this->assertInternalType( 'int', $found->parent );
|
||||
|
@ -125,7 +125,7 @@ class Tests_Term_GetTermBy extends WP_UnitTestCase {
|
||||
$found = get_term_by( 'slug', 'foo', 'wptests_tax' );
|
||||
$num_queries++;
|
||||
|
||||
$this->assertTrue( $found instanceof WP_Term );
|
||||
$this->assertInstanceOf( 'WP_Term', $found );
|
||||
$this->assertSame( $t, $found->term_id );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
|
||||
@ -151,7 +151,7 @@ class Tests_Term_GetTermBy extends WP_UnitTestCase {
|
||||
|
||||
$found = get_term_by( 'name', $term_name_slashed, 'wptests_tax' );
|
||||
|
||||
$this->assertTrue( $found instanceof WP_Term );
|
||||
$this->assertInstanceOf( 'WP_Term', $found );
|
||||
$this->assertSame( $t, $found->term_id );
|
||||
$this->assertSame( $term_name, $found->name );
|
||||
}
|
||||
@ -171,7 +171,7 @@ class Tests_Term_GetTermBy extends WP_UnitTestCase {
|
||||
// Whitespace should get replaced by a '-'.
|
||||
$found1 = get_term_by( 'slug', 'foo foo', 'wptests_tax' );
|
||||
|
||||
$this->assertTrue( $found1 instanceof WP_Term );
|
||||
$this->assertInstanceOf( 'WP_Term', $found1 );
|
||||
$this->assertSame( $t1, $found1->term_id );
|
||||
|
||||
$t2 = self::factory()->term->create(
|
||||
@ -184,7 +184,7 @@ class Tests_Term_GetTermBy extends WP_UnitTestCase {
|
||||
// Slug should get urlencoded.
|
||||
$found2 = get_term_by( 'slug', '仪表盘', 'wptests_tax' );
|
||||
|
||||
$this->assertTrue( $found2 instanceof WP_Term );
|
||||
$this->assertInstanceOf( 'WP_Term', $found2 );
|
||||
$this->assertSame( $t2, $found2->term_id );
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ class Tests_User_UpdateUserCaches extends WP_UnitTestCase {
|
||||
update_user_caches( $user_object );
|
||||
|
||||
$cached = wp_cache_get( $u, 'users' );
|
||||
$this->assertFalse( $cached instanceof WP_User );
|
||||
$this->assertNotInstanceOf( 'WP_User', $cached );
|
||||
$this->assertEquals( $raw_userdata, $cached );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user