diff --git a/tests/phpunit/tests/ajax/DeleteComment.php b/tests/phpunit/tests/ajax/DeleteComment.php index 82409d3b66..bd38671b0d 100644 --- a/tests/phpunit/tests/ajax/DeleteComment.php +++ b/tests/phpunit/tests/ajax/DeleteComment.php @@ -205,7 +205,7 @@ class Tests_Ajax_DeleteComment extends WP_Ajax_UnitTestCase { $this->fail( 'Expected exception: WPAjaxDieStopException' ); } catch ( WPAjaxDieStopException $e ) { $this->assertSame( 10, strlen( $e->getMessage() ) ); - $this->assertTrue( is_numeric( $e->getMessage() ) ); + $this->assertIsNumeric( $e->getMessage() ); } catch ( Exception $e ) { $this->fail( 'Unexpected exception type: ' . get_class( $e ) ); } @@ -255,7 +255,7 @@ class Tests_Ajax_DeleteComment extends WP_Ajax_UnitTestCase { $this->fail( 'Expected exception: WPAjaxDieStopException' ); } catch ( WPAjaxDieStopException $e ) { $this->assertSame( 10, strlen( $e->getMessage() ) ); - $this->assertTrue( is_numeric( $e->getMessage() ) ); + $this->assertIsNumeric( $e->getMessage() ); } catch ( Exception $e ) { $this->fail( 'Unexpected exception type: ' . get_class( $e ) ); } diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php index 8ae0c5d138..430ad49b69 100644 --- a/tests/phpunit/tests/customize/manager.php +++ b/tests/phpunit/tests/customize/manager.php @@ -1214,7 +1214,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase { $this->assertSame( $manager->changeset_uuid(), get_post( $post_id )->post_name, 'Expected that the "__trashed" suffix to not be added.' ); wp_set_current_user( self::$admin_user_id ); $this->assertSame( 'publish', get_post_meta( $post_id, '_wp_trash_meta_status', true ) ); - $this->assertTrue( is_numeric( get_post_meta( $post_id, '_wp_trash_meta_time', true ) ) ); + $this->assertIsNumeric( get_post_meta( $post_id, '_wp_trash_meta_time', true ) ); foreach ( array_keys( $expected_actions ) as $action_name ) { $this->assertSame( $expected_actions[ $action_name ] + $action_counts[ $action_name ], did_action( $action_name ), "Action: $action_name" ); diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php index 02bc5e7e9a..314e6d2899 100644 --- a/tests/phpunit/tests/functions.php +++ b/tests/phpunit/tests/functions.php @@ -1198,7 +1198,7 @@ class Tests_Functions extends WP_UnitTestCase { for ( $i = 0; $i < 20; $i += 1 ) { $id = wp_unique_id(); $this->assertIsString( $id ); - $this->assertTrue( is_numeric( $id ) ); + $this->assertIsNumeric( $id ); $ids[] = $id; } $this->assertSame( $ids, array_unique( $ids ) ); diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php index ebea603414..7923288ec0 100644 --- a/tests/phpunit/tests/post.php +++ b/tests/phpunit/tests/post.php @@ -79,7 +79,7 @@ class Tests_Post extends WP_UnitTestCase { // Insert a post and make sure the ID is OK. $id = wp_insert_post( $post ); - $this->assertTrue( is_numeric( $id ) ); + $this->assertIsNumeric( $id ); $this->assertTrue( $id > 0 ); // Fetch the post and make sure it matches. @@ -135,7 +135,7 @@ class Tests_Post extends WP_UnitTestCase { $id = wp_insert_post( $post ); $this->post_ids[] = $id; // dmp( _get_cron_array() ); - $this->assertTrue( is_numeric( $id ) ); + $this->assertIsNumeric( $id ); $this->assertTrue( $id > 0 ); // Fetch the post and make sure it matches. @@ -258,7 +258,7 @@ class Tests_Post extends WP_UnitTestCase { $id = wp_insert_post( $post ); $this->post_ids[] = $id; // dmp( _get_cron_array() ); - $this->assertTrue( is_numeric( $id ) ); + $this->assertIsNumeric( $id ); $this->assertTrue( $id > 0 ); // Fetch the post and make sure it matches. @@ -379,7 +379,7 @@ class Tests_Post extends WP_UnitTestCase { $id = wp_insert_post( $post ); $this->post_ids[] = $id; // dmp( _get_cron_array() ); - $this->assertTrue( is_numeric( $id ) ); + $this->assertIsNumeric( $id ); $this->assertTrue( $id > 0 ); // Fetch the post and make sure it matches. diff --git a/tests/phpunit/tests/taxonomy.php b/tests/phpunit/tests/taxonomy.php index 241cc26a98..6469563a08 100644 --- a/tests/phpunit/tests/taxonomy.php +++ b/tests/phpunit/tests/taxonomy.php @@ -420,7 +420,7 @@ class Tests_Taxonomy extends WP_UnitTestCase { 'taxonomy' => 'category', 'cat_name' => 'test1', ); - $this->assertTrue( is_numeric( wp_insert_category( $cat, true ) ) ); + $this->assertIsNumeric( wp_insert_category( $cat, true ) ); } function test_insert_category_update() { diff --git a/tests/phpunit/tests/term.php b/tests/phpunit/tests/term.php index ce496df353..98adeb8f92 100644 --- a/tests/phpunit/tests/term.php +++ b/tests/phpunit/tests/term.php @@ -153,7 +153,7 @@ class Tests_Term extends WP_UnitTestCase { $initial_count = wp_count_terms( array( 'taxonomy' => 'category' ) ); $t = wp_insert_category( array( 'cat_name' => $term ) ); - $this->assertTrue( is_numeric( $t ) ); + $this->assertIsNumeric( $t ); $this->assertNotWPError( $t ); $this->assertTrue( $t > 0 ); $this->assertEquals( $initial_count + 1, wp_count_terms( array( 'taxonomy' => 'category' ) ) ); diff --git a/tests/phpunit/tests/theme/getThemeStarterContent.php b/tests/phpunit/tests/theme/getThemeStarterContent.php index df59f83e17..4266bbef93 100644 --- a/tests/phpunit/tests/theme/getThemeStarterContent.php +++ b/tests/phpunit/tests/theme/getThemeStarterContent.php @@ -159,7 +159,7 @@ class Tests_Theme_GetThemeStarterContent extends WP_UnitTestCase { foreach ( $hydrated_starter_content['posts'] as $key => $post ) { $this->assertIsString( $key ); - $this->assertFalse( is_numeric( $key ) ); + $this->assertIsNotNumeric( $key ); $this->assertIsArray( $post ); $this->assertArrayHasKey( 'post_type', $post ); $this->assertArrayHasKey( 'post_title', $post ); diff --git a/tests/phpunit/tests/user.php b/tests/phpunit/tests/user.php index f5ba3982e2..2e599e7ef4 100644 --- a/tests/phpunit/tests/user.php +++ b/tests/phpunit/tests/user.php @@ -482,7 +482,7 @@ class Tests_User extends WP_UnitTestCase { // Insert a post and make sure the ID is OK. $post_id = wp_insert_post( $post ); - $this->assertTrue( is_numeric( $post_id ) ); + $this->assertIsNumeric( $post_id ); setup_postdata( get_post( $post_id ) ); diff --git a/tests/phpunit/tests/user/wpDeleteUser.php b/tests/phpunit/tests/user/wpDeleteUser.php index 8bbf351bb2..6c8aa8b6ce 100644 --- a/tests/phpunit/tests/user/wpDeleteUser.php +++ b/tests/phpunit/tests/user/wpDeleteUser.php @@ -67,7 +67,7 @@ class Tests_User_WpDeleteUser extends WP_UnitTestCase { // Insert a post and make sure the ID is OK. $post_id = wp_insert_post( $post ); - $this->assertTrue( is_numeric( $post_id ) ); + $this->assertIsNumeric( $post_id ); $this->assertTrue( $post_id > 0 ); $post = get_post( $post_id ); @@ -83,7 +83,7 @@ class Tests_User_WpDeleteUser extends WP_UnitTestCase { // Insert a post and make sure the ID is OK. $nav_id = wp_insert_post( $post ); - $this->assertTrue( is_numeric( $nav_id ) ); + $this->assertIsNumeric( $nav_id ); $this->assertTrue( $nav_id > 0 ); $post = get_post( $nav_id );