diff --git a/tests/phpunit/tests/compat/mbStrlen.php b/tests/phpunit/tests/compat/mbStrlen.php index 8d9d73108d83a..4be968e3f39ce 100644 --- a/tests/phpunit/tests/compat/mbStrlen.php +++ b/tests/phpunit/tests/compat/mbStrlen.php @@ -13,8 +13,9 @@ class Tests_Compat_mbStrlen extends WP_UnitTestCase { * Test that the native mb_strlen() is available. */ public function test_mb_strlen_availability() { - $this->assertTrue( - in_array( 'mb_strlen', get_defined_functions()['internal'], true ), + $this->assertContains( + 'mb_strlen', + get_defined_functions()['internal'], 'Test runner should have `mbstring` extension active but doesn’t.' ); } diff --git a/tests/phpunit/tests/compat/mbSubstr.php b/tests/phpunit/tests/compat/mbSubstr.php index 5cc4b3d6778a7..5aee9616b16d1 100644 --- a/tests/phpunit/tests/compat/mbSubstr.php +++ b/tests/phpunit/tests/compat/mbSubstr.php @@ -13,8 +13,9 @@ class Tests_Compat_mbSubstr extends WP_UnitTestCase { * Test that mb_substr() is always available (either from PHP or WP). */ public function test_mb_substr_availability() { - $this->assertTrue( - in_array( 'mb_substr', get_defined_functions()['internal'], true ), + $this->assertContains( + 'mb_substr', + get_defined_functions()['internal'], 'Test runner should have `mbstring` extension active but doesn’t.' ); } diff --git a/tests/phpunit/tests/post/types.php b/tests/phpunit/tests/post/types.php index 96519586d6cff..2c8564f22aeab 100644 --- a/tests/phpunit/tests/post/types.php +++ b/tests/phpunit/tests/post/types.php @@ -343,7 +343,7 @@ public function test_unregister_post_type_removes_query_vars() { $this->assertIsInt( array_search( 'bar', $wp->public_query_vars, true ) ); $this->assertTrue( unregister_post_type( 'foo' ) ); - $this->assertFalse( array_search( 'bar', $wp->public_query_vars, true ) ); + $this->assertNotContains( 'bar', $wp->public_query_vars ); } /** @@ -463,8 +463,8 @@ public function test_unregister_post_type_removes_post_type_from_taxonomies() { $this->assertIsInt( array_search( 'foo', $wp_taxonomies['category']->object_type, true ) ); $this->assertIsInt( array_search( 'foo', $wp_taxonomies['post_tag']->object_type, true ) ); $this->assertTrue( unregister_post_type( 'foo' ) ); - $this->assertFalse( array_search( 'foo', $wp_taxonomies['category']->object_type, true ) ); - $this->assertFalse( array_search( 'foo', $wp_taxonomies['post_tag']->object_type, true ) ); + $this->assertNotContains( 'foo', $wp_taxonomies['category']->object_type ); + $this->assertNotContains( 'foo', $wp_taxonomies['post_tag']->object_type ); $this->assertEmpty( get_object_taxonomies( 'foo' ) ); } diff --git a/tests/phpunit/tests/post/wpPostType.php b/tests/phpunit/tests/post/wpPostType.php index 23ec325a65a54..361ed0343ad0d 100644 --- a/tests/phpunit/tests/post/wpPostType.php +++ b/tests/phpunit/tests/post/wpPostType.php @@ -173,8 +173,8 @@ public function test_adds_rewrite_rules() { $post_type_object->remove_rewrite_rules(); $rewrite_tags_after = $wp_rewrite->rewritecode; - $this->assertNotFalse( array_search( "%$post_type%", $rewrite_tags, true ) ); - $this->assertFalse( array_search( "%$post_type%", $rewrite_tags_after, true ) ); + $this->assertContains( "%$post_type%", $rewrite_tags ); + $this->assertNotContains( "%$post_type%", $rewrite_tags_after ); } public function test_register_meta_boxes() { diff --git a/tests/phpunit/tests/taxonomy.php b/tests/phpunit/tests/taxonomy.php index 13528c3015c6b..39a1a6d90ed5b 100644 --- a/tests/phpunit/tests/taxonomy.php +++ b/tests/phpunit/tests/taxonomy.php @@ -895,7 +895,7 @@ public function test_unregister_taxonomy_removes_query_vars() { $this->assertIsInt( array_search( 'bar', $wp->public_query_vars, true ) ); $this->assertTrue( unregister_taxonomy( 'foo' ) ); - $this->assertFalse( array_search( 'bar', $wp->public_query_vars, true ) ); + $this->assertNotContains( 'bar', $wp->public_query_vars ); } /** diff --git a/tests/phpunit/tests/term/wpTaxonomy.php b/tests/phpunit/tests/term/wpTaxonomy.php index 845497ad0672a..a919e095aa8eb 100644 --- a/tests/phpunit/tests/term/wpTaxonomy.php +++ b/tests/phpunit/tests/term/wpTaxonomy.php @@ -76,8 +76,8 @@ public function test_adds_rewrite_rules() { $taxonomy_object->remove_rewrite_rules(); $rewrite_tags_after = $wp_rewrite->rewritecode; - $this->assertNotFalse( array_search( "%$taxonomy%", $rewrite_tags, true ) ); - $this->assertFalse( array_search( "%$taxonomy%", $rewrite_tags_after, true ) ); + $this->assertContains( "%$taxonomy%", $rewrite_tags ); + $this->assertNotContains( "%$taxonomy%", $rewrite_tags_after ); } public function test_adds_ajax_callback() { diff --git a/tests/phpunit/tests/theme.php b/tests/phpunit/tests/theme.php index aa67f7189c64d..e3b16212650de 100644 --- a/tests/phpunit/tests/theme.php +++ b/tests/phpunit/tests/theme.php @@ -457,7 +457,7 @@ public function test_switch_theme() { $this->assertSame( $theme['Stylesheet'], get_stylesheet() ); $root_fs = $theme->get_theme_root(); - $this->assertTrue( is_dir( $root_fs ) ); + $this->assertDirectoryExists( $root_fs ); $root_uri = $theme->get_theme_root_uri(); $this->assertNotEmpty( $root_uri );