Skip to content

Commit fe9ab38

Browse files
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
1 parent 00824d1 commit fe9ab38

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

tests/phpunit/tests/l10n/loadTextdomainJustInTime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function test_get_translations_for_domain_does_not_return_null_if_overrid
110110
remove_filter( 'override_load_textdomain', '__return_true' );
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

116116
/**

tests/phpunit/tests/term/cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ public function test_get_term_by_does_not_prime_term_meta_cache() {
433433

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 );
439439

tests/phpunit/tests/term/getTerm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function test_numeric_properties_should_be_cast_to_ints() {
135135

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 );
141141
$this->assertInternalType( 'int', $found->parent );

tests/phpunit/tests/term/getTermBy.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function test_should_prime_term_cache() {
125125
$found = get_term_by( 'slug', 'foo', 'wptests_tax' );
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 );
131131

@@ -151,7 +151,7 @@ public function test_should_unslash_name() {
151151

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 );
157157
}
@@ -171,7 +171,7 @@ public function test_should_sanitize_slug() {
171171
// Whitespace should get replaced by a '-'.
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

177177
$t2 = self::factory()->term->create(
@@ -184,7 +184,7 @@ public function test_should_sanitize_slug() {
184184
// Slug should get urlencoded.
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
}
190190

tests/phpunit/tests/user/updateUserCaches.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function test_should_store_raw_data_in_users_bucket_when_passed_a_wp_user
6464
update_user_caches( $user_object );
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
}
7070
}

0 commit comments

Comments
 (0)