diff --git a/tests/phpunit/tests/comment/metaCache.php b/tests/phpunit/tests/comment/metaCache.php index a455654e11fec..bcfd6b5fdbce5 100644 --- a/tests/phpunit/tests/comment/metaCache.php +++ b/tests/phpunit/tests/comment/metaCache.php @@ -233,7 +233,7 @@ public function test_add_metadata_sets_comments_last_changed() { wp_cache_delete( 'last_changed', 'comment' ); - $this->assertInternalType( 'integer', add_metadata( 'comment', $comment_id, 'foo', 'bar' ) ); + $this->assertIsInt( add_metadata( 'comment', $comment_id, 'foo', 'bar' ) ); $this->assertNotFalse( wp_cache_get_last_changed( 'comment' ) ); } @@ -245,7 +245,7 @@ public function test_update_metadata_sets_comments_last_changed() { wp_cache_delete( 'last_changed', 'comment' ); - $this->assertInternalType( 'integer', update_metadata( 'comment', $comment_id, 'foo', 'bar' ) ); + $this->assertIsInt( update_metadata( 'comment', $comment_id, 'foo', 'bar' ) ); $this->assertNotFalse( wp_cache_get_last_changed( 'comment' ) ); } diff --git a/tests/phpunit/tests/comment/query.php b/tests/phpunit/tests/comment/query.php index 23f76c1294eb8..ed6dcae2163da 100644 --- a/tests/phpunit/tests/comment/query.php +++ b/tests/phpunit/tests/comment/query.php @@ -1714,9 +1714,9 @@ function test_fields_ids_query() { ); // Ensure we are dealing with integers, and not objects. - $this->assertInternalType( 'integer', $comment_1 ); - $this->assertInternalType( 'integer', $comment_2 ); - $this->assertInternalType( 'integer', $comment_3 ); + $this->assertIsInt( $comment_1 ); + $this->assertIsInt( $comment_2 ); + $this->assertIsInt( $comment_3 ); $comment_ids = get_comments( array( 'fields' => 'ids' ) ); $this->assertCount( 3, $comment_ids ); diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php index 2b6fa4fac4e5e..f65a7873b779b 100644 --- a/tests/phpunit/tests/customize/manager.php +++ b/tests/phpunit/tests/customize/manager.php @@ -731,7 +731,7 @@ function test_import_theme_starter_content() { $this->assertNull( $wp_customize->changeset_post_id() ); $this->assertEquals( 1000, has_action( 'customize_register', array( $wp_customize, '_save_starter_content_changeset' ) ) ); do_action( 'customize_register', $wp_customize ); // This will trigger the changeset save. - $this->assertInternalType( 'int', $wp_customize->changeset_post_id() ); + $this->assertIsInt( $wp_customize->changeset_post_id() ); $this->assertNotEmpty( $wp_customize->changeset_data() ); foreach ( $wp_customize->changeset_data() as $setting_id => $setting_params ) { $this->assertArrayHasKey( 'starter_content', $setting_params ); diff --git a/tests/phpunit/tests/customize/nav-menu-setting.php b/tests/phpunit/tests/customize/nav-menu-setting.php index bc29b49bcbcf5..446f9804b01c8 100644 --- a/tests/phpunit/tests/customize/nav-menu-setting.php +++ b/tests/phpunit/tests/customize/nav-menu-setting.php @@ -225,7 +225,7 @@ function test_preview_updated() { $menus = wp_get_nav_menus(); $menus_ids = wp_list_pluck( $menus, 'term_id' ); $i = array_search( $menu_id, $menus_ids, true ); - $this->assertInternalType( 'int', $i, 'Update-previewed menu does not appear in wp_get_nav_menus()' ); + $this->assertIsInt( $i, 'Update-previewed menu does not appear in wp_get_nav_menus()' ); $filtered_menu = $menus[ $i ]; $this->assertEquals( 'Name 2 \\o/', $filtered_menu->name ); } @@ -270,7 +270,7 @@ function test_preview_inserted() { $menus = wp_get_nav_menus(); $menus_ids = wp_list_pluck( $menus, 'term_id' ); $i = array_search( $menu_id, $menus_ids, true ); - $this->assertInternalType( 'int', $i, 'Insert-previewed menu was not injected into wp_get_nav_menus()' ); + $this->assertIsInt( $i, 'Insert-previewed menu was not injected into wp_get_nav_menus()' ); $filtered_menu = $menus[ $i ]; $this->assertEquals( 'New Menu Name 1 \\o/', $filtered_menu->name ); } diff --git a/tests/phpunit/tests/customize/panel.php b/tests/phpunit/tests/customize/panel.php index 6e3f4ba7076e0..dd10450b055d4 100644 --- a/tests/phpunit/tests/customize/panel.php +++ b/tests/phpunit/tests/customize/panel.php @@ -31,7 +31,7 @@ function tearDown(): void { */ function test_construct_default_args() { $panel = new WP_Customize_Panel( $this->manager, 'foo' ); - $this->assertInternalType( 'int', $panel->instance_number ); + $this->assertIsInt( $panel->instance_number ); $this->assertEquals( $this->manager, $panel->manager ); $this->assertEquals( 'foo', $panel->id ); $this->assertEquals( 160, $panel->priority ); @@ -125,7 +125,7 @@ function test_json() { } $this->assertEmpty( $data['content'] ); $this->assertTrue( $data['active'] ); - $this->assertInternalType( 'int', $data['instanceNumber'] ); + $this->assertIsInt( $data['instanceNumber'] ); } /** diff --git a/tests/phpunit/tests/customize/section.php b/tests/phpunit/tests/customize/section.php index baf03d8b3c092..b269408462d9a 100644 --- a/tests/phpunit/tests/customize/section.php +++ b/tests/phpunit/tests/customize/section.php @@ -38,7 +38,7 @@ function tearDown(): void { */ function test_construct_default_args() { $section = new WP_Customize_Section( $this->manager, 'foo' ); - $this->assertInternalType( 'int', $section->instance_number ); + $this->assertIsInt( $section->instance_number ); $this->assertEquals( $this->manager, $section->manager ); $this->assertEquals( 'foo', $section->id ); $this->assertEquals( 160, $section->priority ); @@ -139,7 +139,7 @@ function test_json() { } $this->assertEmpty( $data['content'] ); $this->assertTrue( $data['active'] ); - $this->assertInternalType( 'int', $data['instanceNumber'] ); + $this->assertIsInt( $data['instanceNumber'] ); } /** diff --git a/tests/phpunit/tests/date/currentTime.php b/tests/phpunit/tests/date/currentTime.php index 490a8c907005d..37606748517a1 100644 --- a/tests/phpunit/tests/date/currentTime.php +++ b/tests/phpunit/tests/date/currentTime.php @@ -98,7 +98,7 @@ public function test_should_return_wp_timestamp() { $this->assertEquals( $wp_timestamp, current_time( 'U' ), 'The dates should be equal', 2 ); // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested - $this->assertInternalType( 'int', current_time( 'timestamp' ) ); + $this->assertIsInt( current_time( 'timestamp' ) ); } /** diff --git a/tests/phpunit/tests/image/header.php b/tests/phpunit/tests/image/header.php index e2630a1c25ffd..cff8e24ae0d54 100644 --- a/tests/phpunit/tests/image/header.php +++ b/tests/phpunit/tests/image/header.php @@ -147,7 +147,7 @@ function test_insert_cropped_attachment() { $cropped_id = $this->custom_image_header->insert_attachment( $object, $cropped ); - $this->assertInternalType( 'int', $cropped_id ); + $this->assertIsInt( $cropped_id ); $this->assertGreaterThan( 0, $cropped_id ); } diff --git a/tests/phpunit/tests/image/siteIcon.php b/tests/phpunit/tests/image/siteIcon.php index ee618d40d39e4..cb40c8c987824 100644 --- a/tests/phpunit/tests/image/siteIcon.php +++ b/tests/phpunit/tests/image/siteIcon.php @@ -120,7 +120,7 @@ function test_insert_cropped_attachment() { $object = $this->wp_site_icon->create_attachment_object( $cropped, $attachment_id ); $cropped_id = $this->wp_site_icon->insert_attachment( $object, $cropped ); - $this->assertInternalType( 'int', $cropped_id ); + $this->assertIsInt( $cropped_id ); $this->assertGreaterThan( 0, $cropped_id ); } diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index 6b6b1d82f955b..d4222e7022519 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -1132,7 +1132,7 @@ function _upload_dir( $dir ) { */ function test_attachment_url_to_postid_with_empty_url() { $post_id = attachment_url_to_postid( '' ); - $this->assertInternalType( 'int', $post_id ); + $this->assertIsInt( $post_id ); $this->assertEquals( 0, $post_id ); } diff --git a/tests/phpunit/tests/meta.php b/tests/phpunit/tests/meta.php index 2e2ed46571e22..b321e6b53400a 100644 --- a/tests/phpunit/tests/meta.php +++ b/tests/phpunit/tests/meta.php @@ -207,11 +207,11 @@ function test_metadata_slashes() { $this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) ); $this->assertFalse( delete_metadata( 'user', $this->author->ID, $key ) ); $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) ); - $this->assertInternalType( 'int', add_metadata( 'user', $this->author->ID, $key, $value ) ); + $this->assertIsInt( add_metadata( 'user', $this->author->ID, $key, $value ) ); $this->assertEquals( $expected, get_metadata( 'user', $this->author->ID, $key, true ) ); $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) ); $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) ); - $this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value ) ); + $this->assertIsInt( update_metadata( 'user', $this->author->ID, $key, $value ) ); $this->assertEquals( $expected, get_metadata( 'user', $this->author->ID, $key, true ) ); $this->assertTrue( update_metadata( 'user', $this->author->ID, $key, 'blah' ) ); $this->assertEquals( 'blah', get_metadata( 'user', $this->author->ID, $key, true ) ); @@ -220,11 +220,11 @@ function test_metadata_slashes() { $this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) ); // Test overslashing. - $this->assertInternalType( 'int', add_metadata( 'user', $this->author->ID, $key, $value2 ) ); + $this->assertIsInt( add_metadata( 'user', $this->author->ID, $key, $value2 ) ); $this->assertEquals( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) ); $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) ); $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) ); - $this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value2 ) ); + $this->assertIsInt( update_metadata( 'user', $this->author->ID, $key, $value2 ) ); $this->assertEquals( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) ); } diff --git a/tests/phpunit/tests/multisite/network.php b/tests/phpunit/tests/multisite/network.php index 2ed8f4f6692b4..cab5442334f93 100644 --- a/tests/phpunit/tests/multisite/network.php +++ b/tests/phpunit/tests/multisite/network.php @@ -352,7 +352,7 @@ function test_wp_schedule_update_network_counts() { // We can't use wp_schedule_update_network_counts() because WP_INSTALLING is set. wp_schedule_event( time(), 'twicedaily', 'update_network_counts' ); - $this->assertInternalType( 'int', wp_next_scheduled( 'update_network_counts' ) ); + $this->assertIsInt( wp_next_scheduled( 'update_network_counts' ) ); } /** @@ -365,7 +365,7 @@ function test_get_dashboard_blog() { $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); $blog_id = self::factory()->blog->create( array( 'user_id' => $user_id ) ); - $this->assertInternalType( 'int', $blog_id ); + $this->assertIsInt( $blog_id ); // Set the dashboard blog to another one. update_site_option( 'dashboard_blog', $blog_id ); diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php index 4b2fd48265368..1196adeecd1da 100644 --- a/tests/phpunit/tests/multisite/site.php +++ b/tests/phpunit/tests/multisite/site.php @@ -94,7 +94,7 @@ function test_switch_restore_blog() { $this->assertEquals( array(), $_wp_switched_stack ); $this->assertFalse( ms_is_switched() ); $current_blog_id = get_current_blog_id(); - $this->assertInternalType( 'integer', $current_blog_id ); + $this->assertIsInt( $current_blog_id ); wp_cache_set( 'switch-test', $current_blog_id, 'switch-test' ); $this->assertEquals( $current_blog_id, wp_cache_get( 'switch-test', 'switch-test' ) ); @@ -141,7 +141,7 @@ function test_created_site_details() { $blog_id = self::factory()->blog->create(); - $this->assertInternalType( 'int', $blog_id ); + $this->assertIsInt( $blog_id ); $prefix = $wpdb->get_blog_prefix( $blog_id ); // $get_all = false, only retrieve details from the blogs table. @@ -1298,7 +1298,7 @@ public function test_wp_insert_site( $site_data, $expected_data ) { remove_action( 'wp_initialize_site', 'wp_initialize_site', 10 ); $site_id = wp_insert_site( $site_data ); - $this->assertInternalType( 'integer', $site_id ); + $this->assertIsInt( $site_id ); $site = get_site( $site_id ); foreach ( $expected_data as $key => $value ) { @@ -1404,7 +1404,7 @@ public function test_wp_insert_site_with_clean_site_cache() { remove_action( 'clean_site_cache', array( $this, 'action_database_insert_on_clean_site_cache' ) ); - $this->assertInternalType( 'integer', $site_id ); + $this->assertIsInt( $site_id ); } @@ -1789,7 +1789,7 @@ public function test_site_dates_are_gmt() { 'network_id' => 1, ) ); - $this->assertInternalType( 'integer', $site_id ); + $this->assertIsInt( $site_id ); $site = get_site( $site_id ); $this->assertEquals( strtotime( $first_date ), strtotime( $site->registered ), 'The dates should be equal', 2 ); @@ -1797,7 +1797,7 @@ public function test_site_dates_are_gmt() { $second_date = current_time( 'mysql', true ); $site_id = wp_update_site( $site_id, array() ); - $this->assertInternalType( 'integer', $site_id ); + $this->assertIsInt( $site_id ); $site = get_site( $site_id ); $this->assertEquals( strtotime( $first_date ), strtotime( $site->registered ), 'The dates should be equal', 2 ); diff --git a/tests/phpunit/tests/multisite/siteMeta.php b/tests/phpunit/tests/multisite/siteMeta.php index 3eee11eb97df1..6676c034dfad8 100644 --- a/tests/phpunit/tests/multisite/siteMeta.php +++ b/tests/phpunit/tests/multisite/siteMeta.php @@ -157,7 +157,7 @@ public function test_update_should_pass_to_add_when_no_value_exists_for_key() { } $actual = update_site_meta( self::$site_id, 'foo', 'bar' ); - $this->assertInternalType( 'int', $actual ); + $this->assertIsInt( $actual ); $this->assertNotEmpty( $actual ); $meta = get_site_meta( self::$site_id, 'foo', true ); diff --git a/tests/phpunit/tests/option/multisite.php b/tests/phpunit/tests/option/multisite.php index e08c21be3a289..ee59b8e877636 100644 --- a/tests/phpunit/tests/option/multisite.php +++ b/tests/phpunit/tests/option/multisite.php @@ -99,7 +99,7 @@ function test_from_same_site_with_null_blog_id() { function test_with_another_site() { $user_id = self::factory()->user->create(); - $this->assertInternalType( 'integer', $user_id ); + $this->assertIsInt( $user_id ); $blog_id = self::factory()->blog->create( array( @@ -107,7 +107,7 @@ function test_with_another_site() { 'public' => 1, ) ); - $this->assertInternalType( 'integer', $blog_id ); + $this->assertIsInt( $blog_id ); $key = __FUNCTION__ . '_key1'; $key2 = __FUNCTION__ . '_key2'; diff --git a/tests/phpunit/tests/post/meta.php b/tests/phpunit/tests/post/meta.php index 8876ce5cb08fb..81d649a44571b 100644 --- a/tests/phpunit/tests/post/meta.php +++ b/tests/phpunit/tests/post/meta.php @@ -46,7 +46,7 @@ public static function wpTearDownAfterClass() { function test_unique_postmeta() { // Add a unique post meta item. - $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'unique', 'value', true ) ); + $this->assertIsInt( add_post_meta( self::$post_id, 'unique', 'value', true ) ); // Check unique is enforced. $this->assertFalse( add_post_meta( self::$post_id, 'unique', 'another value', true ) ); @@ -69,8 +69,8 @@ function test_unique_postmeta() { function test_nonunique_postmeta() { // Add two non-unique post meta items. - $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'nonunique', 'value' ) ); - $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'nonunique', 'another value' ) ); + $this->assertIsInt( add_post_meta( self::$post_id, 'nonunique', 'value' ) ); + $this->assertIsInt( add_post_meta( self::$post_id, 'nonunique', 'another value' ) ); // Check they exist. $this->assertEquals( 'value', get_post_meta( self::$post_id, 'nonunique', true ) ); @@ -87,7 +87,7 @@ function test_nonunique_postmeta() { $this->assertEquals( array( 'another value' ), get_post_meta( self::$post_id, 'nonunique', false ) ); // Add a third one. - $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'nonunique', 'someother value' ) ); + $this->assertIsInt( add_post_meta( self::$post_id, 'nonunique', 'someother value' ) ); // Check they exist. $expected = array( @@ -106,11 +106,11 @@ function test_nonunique_postmeta() { function test_update_post_meta() { // Add a unique post meta item. - $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'unique_update', 'value', true ) ); + $this->assertIsInt( add_post_meta( self::$post_id, 'unique_update', 'value', true ) ); // Add two non-unique post meta items. - $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'nonunique_update', 'value' ) ); - $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'nonunique_update', 'another value' ) ); + $this->assertIsInt( add_post_meta( self::$post_id, 'nonunique_update', 'value' ) ); + $this->assertIsInt( add_post_meta( self::$post_id, 'nonunique_update', 'another value' ) ); // Check they exist. $this->assertEquals( 'value', get_post_meta( self::$post_id, 'unique_update', true ) ); @@ -133,8 +133,8 @@ function test_update_post_meta() { function test_delete_post_meta() { // Add two unique post meta items. - $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'unique_delete', 'value', true ) ); - $this->assertInternalType( 'integer', add_post_meta( self::$post_id_2, 'unique_delete', 'value', true ) ); + $this->assertIsInt( add_post_meta( self::$post_id, 'unique_delete', 'value', true ) ); + $this->assertIsInt( add_post_meta( self::$post_id_2, 'unique_delete', 'value', true ) ); // Check they exist. $this->assertEquals( 'value', get_post_meta( self::$post_id, 'unique_delete', true ) ); @@ -150,8 +150,8 @@ function test_delete_post_meta() { function test_delete_post_meta_by_key() { // Add two unique post meta items. - $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'unique_delete_by_key', 'value', true ) ); - $this->assertInternalType( 'integer', add_post_meta( self::$post_id_2, 'unique_delete_by_key', 'value', true ) ); + $this->assertIsInt( add_post_meta( self::$post_id, 'unique_delete_by_key', 'value', true ) ); + $this->assertIsInt( add_post_meta( self::$post_id_2, 'unique_delete_by_key', 'value', true ) ); // Check they exist. $this->assertEquals( 'value', get_post_meta( self::$post_id, 'unique_delete_by_key', true ) ); @@ -167,7 +167,7 @@ function test_delete_post_meta_by_key() { function test_get_post_meta_by_id() { $mid = add_post_meta( self::$post_id, 'get_post_meta_by_key', 'get_post_meta_by_key_value', true ); - $this->assertInternalType( 'integer', $mid ); + $this->assertIsInt( $mid ); $mobj = new stdClass; $mobj->meta_id = $mid; @@ -178,7 +178,7 @@ function test_get_post_meta_by_id() { delete_metadata_by_mid( 'post', $mid ); $mid = add_post_meta( self::$post_id, 'get_post_meta_by_key', array( 'foo', 'bar' ), true ); - $this->assertInternalType( 'integer', $mid ); + $this->assertIsInt( $mid ); $mobj->meta_id = $mid; $mobj->meta_value = array( 'foo', 'bar' ); $this->assertEquals( $mobj, get_post_meta_by_id( $mid ) ); @@ -187,7 +187,7 @@ function test_get_post_meta_by_id() { function test_delete_meta() { $mid = add_post_meta( self::$post_id, 'delete_meta', 'delete_meta_value', true ); - $this->assertInternalType( 'integer', $mid ); + $this->assertIsInt( $mid ); $this->assertTrue( delete_meta( $mid ) ); $this->assertFalse( get_metadata_by_mid( 'post', $mid ) ); @@ -197,11 +197,11 @@ function test_delete_meta() { function test_update_meta() { // Add a unique post meta item. - $this->assertInternalType( 'integer', $mid1 = add_post_meta( self::$post_id, 'unique_update', 'value', true ) ); + $this->assertIsInt( $mid1 = add_post_meta( self::$post_id, 'unique_update', 'value', true ) ); // Add two non-unique post meta items. - $this->assertInternalType( 'integer', $mid2 = add_post_meta( self::$post_id, 'nonunique_update', 'value' ) ); - $this->assertInternalType( 'integer', $mid3 = add_post_meta( self::$post_id, 'nonunique_update', 'another value' ) ); + $this->assertIsInt( $mid2 = add_post_meta( self::$post_id, 'nonunique_update', 'value' ) ); + $this->assertIsInt( $mid3 = add_post_meta( self::$post_id, 'nonunique_update', 'another value' ) ); // Check they exist. $this->assertEquals( 'value', get_post_meta( self::$post_id, 'unique_update', true ) ); @@ -242,7 +242,7 @@ function test_funky_post_meta() { $funky_meta[] = $classy; // Add a post meta item. - $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'test_funky_post_meta', $funky_meta, true ) ); + $this->assertIsInt( add_post_meta( self::$post_id, 'test_funky_post_meta', $funky_meta, true ) ); // Check it exists. $this->assertEquals( $funky_meta, get_post_meta( self::$post_id, 'test_funky_post_meta', true ) ); @@ -318,7 +318,7 @@ public function test_add_metadata_sets_posts_last_changed() { wp_cache_delete( 'last_changed', 'posts' ); - $this->assertInternalType( 'integer', add_metadata( 'post', $post_id, 'foo', 'bar' ) ); + $this->assertIsInt( add_metadata( 'post', $post_id, 'foo', 'bar' ) ); $this->assertNotFalse( wp_cache_get_last_changed( 'posts' ) ); } @@ -330,7 +330,7 @@ public function test_update_metadata_sets_posts_last_changed() { wp_cache_delete( 'last_changed', 'posts' ); - $this->assertInternalType( 'integer', update_metadata( 'post', $post_id, 'foo', 'bar' ) ); + $this->assertIsInt( update_metadata( 'post', $post_id, 'foo', 'bar' ) ); $this->assertNotFalse( wp_cache_get_last_changed( 'posts' ) ); } diff --git a/tests/phpunit/tests/post/objects.php b/tests/phpunit/tests/post/objects.php index 8b03053302c84..a803e357c78d8 100644 --- a/tests/phpunit/tests/post/objects.php +++ b/tests/phpunit/tests/post/objects.php @@ -167,7 +167,7 @@ function test_get_post_filter() { ); $this->assertEquals( 'raw', $post->filter ); - $this->assertInternalType( 'int', $post->post_parent ); + $this->assertIsInt( $post->post_parent ); $display_post = get_post( $post, OBJECT, 'js' ); $this->assertEquals( 'js', $display_post->filter ); diff --git a/tests/phpunit/tests/post/query.php b/tests/phpunit/tests/post/query.php index eae2138de2524..2513bf03b43e5 100644 --- a/tests/phpunit/tests/post/query.php +++ b/tests/phpunit/tests/post/query.php @@ -737,7 +737,7 @@ public function test_found_posts_should_be_integer_not_string() { ) ); - $this->assertInternalType( 'int', $q->found_posts ); + $this->assertIsInt( $q->found_posts ); } /** @@ -756,6 +756,6 @@ public function test_found_posts_should_be_integer_even_if_found_posts_filter_re remove_filter( 'found_posts', '__return_empty_string' ); - $this->assertInternalType( 'int', $q->found_posts ); + $this->assertIsInt( $q->found_posts ); } } diff --git a/tests/phpunit/tests/post/types.php b/tests/phpunit/tests/post/types.php index fe17dfecc86fe..a52e9b7429260 100644 --- a/tests/phpunit/tests/post/types.php +++ b/tests/phpunit/tests/post/types.php @@ -321,7 +321,7 @@ public function test_unregister_post_type_removes_query_vars() { ) ); - $this->assertInternalType( 'int', array_search( 'bar', $wp->public_query_vars, true ) ); + $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 ) ); } @@ -439,8 +439,8 @@ public function test_unregister_post_type_removes_post_type_from_taxonomies() { ) ); - $this->assertInternalType( 'int', array_search( 'foo', $wp_taxonomies['category']->object_type, true ) ); - $this->assertInternalType( 'int', array_search( 'foo', $wp_taxonomies['post_tag']->object_type, true ) ); + $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 ) ); diff --git a/tests/phpunit/tests/query/results.php b/tests/phpunit/tests/query/results.php index 901e021599621..cd08fe3a45e09 100644 --- a/tests/phpunit/tests/query/results.php +++ b/tests/phpunit/tests/query/results.php @@ -765,8 +765,8 @@ function test_query_fields_integers() { $this->assertSame( $children, $posts2 ); foreach ( $this->q->posts as $post ) { - $this->assertInternalType( 'int', $post->ID ); - $this->assertInternalType( 'int', $post->post_parent ); + $this->assertIsInt( $post->ID ); + $this->assertIsInt( $post->post_parent ); } } diff --git a/tests/phpunit/tests/taxonomy.php b/tests/phpunit/tests/taxonomy.php index a6fd7e04ed284..ec39b0a7db0b6 100644 --- a/tests/phpunit/tests/taxonomy.php +++ b/tests/phpunit/tests/taxonomy.php @@ -818,7 +818,7 @@ public function test_unregister_taxonomy_removes_query_vars() { register_taxonomy( 'foo', 'post', array( 'query_var' => 'bar' ) ); - $this->assertInternalType( 'int', array_search( 'bar', $wp->public_query_vars, true ) ); + $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 ) ); } diff --git a/tests/phpunit/tests/term/getTerm.php b/tests/phpunit/tests/term/getTerm.php index 5d557bf3d02e1..70991248734fe 100644 --- a/tests/phpunit/tests/term/getTerm.php +++ b/tests/phpunit/tests/term/getTerm.php @@ -113,7 +113,7 @@ public function test_output_array_n() { $this->assertIsArray( $term ); $this->assertFalse( isset( $term['term_id'] ) ); foreach ( $term as $k => $v ) { - $this->assertInternalType( 'integer', $k ); + $this->assertIsInt( $k ); } } @@ -136,11 +136,11 @@ public function test_numeric_properties_should_be_cast_to_ints() { $found = get_term( $term_data ); $this->assertTrue( $found instanceof WP_Term ); - $this->assertInternalType( 'int', $found->term_id ); - $this->assertInternalType( 'int', $found->term_taxonomy_id ); - $this->assertInternalType( 'int', $found->parent ); - $this->assertInternalType( 'int', $found->count ); - $this->assertInternalType( 'int', $found->term_group ); + $this->assertIsInt( $found->term_id ); + $this->assertIsInt( $found->term_taxonomy_id ); + $this->assertIsInt( $found->parent ); + $this->assertIsInt( $found->count ); + $this->assertIsInt( $found->term_group ); } /** diff --git a/tests/phpunit/tests/term/meta.php b/tests/phpunit/tests/term/meta.php index 3a0f65e565f08..a5a13300190ad 100644 --- a/tests/phpunit/tests/term/meta.php +++ b/tests/phpunit/tests/term/meta.php @@ -94,7 +94,7 @@ public function test_update_should_pass_to_add_when_no_value_exists_for_key() { $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); $actual = update_term_meta( $t, 'foo', 'bar' ); - $this->assertInternalType( 'int', $actual ); + $this->assertIsInt( $actual ); $this->assertNotEmpty( $actual ); $meta = get_term_meta( $t, 'foo', true ); @@ -546,7 +546,7 @@ public function test_add_metadata_sets_terms_last_changed() { wp_cache_delete( 'last_changed', 'terms' ); - $this->assertInternalType( 'integer', add_metadata( 'term', $term_id, 'foo', 'bar' ) ); + $this->assertIsInt( add_metadata( 'term', $term_id, 'foo', 'bar' ) ); $this->assertNotFalse( wp_cache_get_last_changed( 'terms' ) ); } @@ -558,7 +558,7 @@ public function test_update_metadata_sets_terms_last_changed() { wp_cache_delete( 'last_changed', 'terms' ); - $this->assertInternalType( 'integer', update_metadata( 'term', $term_id, 'foo', 'bar' ) ); + $this->assertIsInt( update_metadata( 'term', $term_id, 'foo', 'bar' ) ); $this->assertNotFalse( wp_cache_get_last_changed( 'terms' ) ); } diff --git a/tests/phpunit/tests/term/wpGetObjectTerms.php b/tests/phpunit/tests/term/wpGetObjectTerms.php index ad1cd94d4c5d1..075c6a6b41108 100644 --- a/tests/phpunit/tests/term/wpGetObjectTerms.php +++ b/tests/phpunit/tests/term/wpGetObjectTerms.php @@ -73,12 +73,12 @@ public function test_should_return_objects_with_int_properties() { $term = array_shift( $terms ); $int_fields = array( 'parent', 'term_id', 'count', 'term_group', 'term_taxonomy_id', 'object_id' ); foreach ( $int_fields as $field ) { - $this->assertInternalType( 'int', $term->$field, $field ); + $this->assertIsInt( $term->$field, $field ); } $terms = wp_get_object_terms( $post_id, $this->taxonomy, array( 'fields' => 'ids' ) ); $term = array_shift( $terms ); - $this->assertInternalType( 'int', $term, 'term' ); + $this->assertIsInt( $term, 'term' ); } /** diff --git a/tests/phpunit/tests/term/wpInsertTerm.php b/tests/phpunit/tests/term/wpInsertTerm.php index 401225f444d2b..9e3d4c6f6f6a9 100644 --- a/tests/phpunit/tests/term/wpInsertTerm.php +++ b/tests/phpunit/tests/term/wpInsertTerm.php @@ -844,8 +844,8 @@ public function test_wp_insert_term_with_and_without_accents() { ) ); - $this->assertInternalType( 'int', $t1 ); - $this->assertInternalType( 'int', $t2 ); + $this->assertIsInt( $t1 ); + $this->assertIsInt( $t2 ); $this->assertNotEquals( $t1, $t2 ); $term_2 = get_term( $t2, 'wptests_tax' ); @@ -901,9 +901,9 @@ public function test_wp_insert_term_with_null_description() { public function deleted_term_cb( $term, $tt_id, $taxonomy, $deleted_term, $object_ids ) { $this->assertInternalType( 'object', $deleted_term ); - $this->assertInternalType( 'int', $term ); + $this->assertIsInt( $term ); $this->assertIsArray( $object_ids ); - // Pesky string $this->assertInternalType( 'int', $tt_id ); + // Pesky string $this->assertIsInt( $tt_id ); $this->assertEquals( $term, $deleted_term->term_id ); $this->assertEquals( $taxonomy, $deleted_term->taxonomy ); $this->assertEquals( $tt_id, $deleted_term->term_taxonomy_id ); diff --git a/tests/phpunit/tests/term/wpUpdateTerm.php b/tests/phpunit/tests/term/wpUpdateTerm.php index 0797d4ab0676f..28e04a3fcefdd 100644 --- a/tests/phpunit/tests/term/wpUpdateTerm.php +++ b/tests/phpunit/tests/term/wpUpdateTerm.php @@ -638,8 +638,8 @@ public function test_wp_update_term_should_return_int_values_for_term_id_and_ter ) ); - $this->assertInternalType( 'int', $found['term_id'] ); - $this->assertInternalType( 'int', $found['term_taxonomy_id'] ); + $this->assertIsInt( $found['term_id'] ); + $this->assertIsInt( $found['term_taxonomy_id'] ); } public function test_wp_update_term_should_clean_term_cache() { diff --git a/tests/phpunit/tests/user.php b/tests/phpunit/tests/user.php index 99f0ff5d53245..3271c9d5d83f0 100644 --- a/tests/phpunit/tests/user.php +++ b/tests/phpunit/tests/user.php @@ -855,7 +855,7 @@ public function test_wp_insert_user_should_accept_user_login_with_60_characters( ) ); - $this->assertInternalType( 'int', $u ); + $this->assertIsInt( $u ); $this->assertGreaterThan( 0, $u ); $user = new WP_User( $u ); @@ -1477,7 +1477,7 @@ function test_edit_user_blank_pw() { $user_id = edit_user(); $user = get_user_by( 'ID', $user_id ); - $this->assertInternalType( 'int', $user_id ); + $this->assertIsInt( $user_id ); $this->assertInstanceOf( 'WP_User', $user ); $this->assertEquals( 'nickname1', $user->nickname ); @@ -1488,7 +1488,7 @@ function test_edit_user_blank_pw() { $user_id = edit_user( $user_id ); - $this->assertInternalType( 'int', $user_id ); + $this->assertIsInt( $user_id ); $this->assertEquals( 'nickname_updated', $user->nickname ); // Check updating user with missing second password. @@ -1507,7 +1507,7 @@ function test_edit_user_blank_pw() { $user_id = edit_user( $user_id ); remove_action( 'check_passwords', array( $this, 'action_check_passwords_blank_pw' ) ); - $this->assertInternalType( 'int', $user_id ); + $this->assertIsInt( $user_id ); $this->assertEquals( 'nickname_updated2', $user->nickname ); } diff --git a/tests/phpunit/tests/user/multisite.php b/tests/phpunit/tests/user/multisite.php index 94a2e78567b8b..0b00027abae43 100644 --- a/tests/phpunit/tests/user/multisite.php +++ b/tests/phpunit/tests/user/multisite.php @@ -124,7 +124,7 @@ function test_is_blog_user() { $blog_id = self::factory()->blog->create( array( 'user_id' => get_current_user_id() ) ); - $this->assertInternalType( 'int', $blog_id ); + $this->assertIsInt( $blog_id ); $this->assertTrue( is_blog_user( $blog_id ) ); $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) ); $this->assertFalse( is_blog_user( $blog_id ) ); @@ -156,7 +156,7 @@ function test_is_user_member_of_blog() { $blog_id = self::factory()->blog->create( array( 'user_id' => get_current_user_id() ) ); - $this->assertInternalType( 'int', $blog_id ); + $this->assertIsInt( $blog_id ); // Current user gets added to new blogs. $this->assertTrue( is_user_member_of_blog( $user1_id, $blog_id ) ); diff --git a/tests/phpunit/tests/widgets.php b/tests/phpunit/tests/widgets.php index 273ee61802931..ba57ab53283cf 100644 --- a/tests/phpunit/tests/widgets.php +++ b/tests/phpunit/tests/widgets.php @@ -1063,7 +1063,7 @@ public function test__wp_remove_unregistered_widgets() { $this->assertEmpty( $filtered_widgets['fantasy'] ); $this->assertArrayHasKey( 'array_version', $filtered_widgets ); $this->assertEquals( 3, $filtered_widgets['array_version'] ); - $this->assertInternalType( 'integer', $filtered_widgets['array_version'] ); + $this->assertIsInt( $filtered_widgets['array_version'] ); } /** diff --git a/tests/phpunit/tests/xmlrpc/mw/getPost.php b/tests/phpunit/tests/xmlrpc/mw/getPost.php index 2877b1da7eb29..bd015319100c6 100644 --- a/tests/phpunit/tests/xmlrpc/mw/getPost.php +++ b/tests/phpunit/tests/xmlrpc/mw/getPost.php @@ -53,7 +53,7 @@ function test_valid_post() { // Check data types. $this->assertInternalType( 'string', $result['userid'] ); - $this->assertInternalType( 'int', $result['postid'] ); + $this->assertIsInt( $result['postid'] ); $this->assertInternalType( 'string', $result['description'] ); $this->assertInternalType( 'string', $result['title'] ); $this->assertInternalType( 'string', $result['link'] ); @@ -62,8 +62,8 @@ function test_valid_post() { $this->assertInternalType( 'string', $result['mt_excerpt'] ); $this->assertInternalType( 'string', $result['mt_text_more'] ); $this->assertInternalType( 'string', $result['wp_more_text'] ); - $this->assertInternalType( 'int', $result['mt_allow_comments'] ); - $this->assertInternalType( 'int', $result['mt_allow_pings'] ); + $this->assertIsInt( $result['mt_allow_comments'] ); + $this->assertIsInt( $result['mt_allow_pings'] ); $this->assertInternalType( 'string', $result['mt_keywords'] ); $this->assertInternalType( 'string', $result['wp_slug'] ); $this->assertInternalType( 'string', $result['wp_password'] ); @@ -102,7 +102,7 @@ function test_post_thumbnail() { $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'author', 'author' ) ); $this->assertNotIXRError( $result ); - $this->assertInternalType( 'int', $result['wp_post_thumbnail'] ); + $this->assertIsInt( $result['wp_post_thumbnail'] ); $this->assertEquals( $attachment_id, $result['wp_post_thumbnail'] ); remove_theme_support( 'post-thumbnails' ); diff --git a/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php b/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php index c20e81f7248fe..4513bdd1e7046 100644 --- a/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php +++ b/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php @@ -68,8 +68,8 @@ function test_valid_post() { $this->assertInternalType( 'string', $result['mt_excerpt'] ); $this->assertInternalType( 'string', $result['mt_text_more'] ); $this->assertInternalType( 'string', $result['wp_more_text'] ); - $this->assertInternalType( 'int', $result['mt_allow_comments'] ); - $this->assertInternalType( 'int', $result['mt_allow_pings'] ); + $this->assertIsInt( $result['mt_allow_comments'] ); + $this->assertIsInt( $result['mt_allow_pings'] ); $this->assertInternalType( 'string', $result['mt_keywords'] ); $this->assertInternalType( 'string', $result['wp_slug'] ); $this->assertInternalType( 'string', $result['wp_password'] ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php b/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php index 746761bb9ac62..7f1b4f894d547 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php +++ b/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php @@ -51,7 +51,7 @@ function test_valid_media_item() { // Check data types. $this->assertInternalType( 'string', $result['attachment_id'] ); - $this->assertInternalType( 'int', $result['parent'] ); + $this->assertIsInt( $result['parent'] ); $this->assertInternalType( 'string', $result['title'] ); $this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] ); $this->assertInternalType( 'string', $result['caption'] ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getPage.php b/tests/phpunit/tests/xmlrpc/wp/getPage.php index 061e6a2f1221d..9a8eae0d45d46 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getPage.php +++ b/tests/phpunit/tests/xmlrpc/wp/getPage.php @@ -47,7 +47,7 @@ function test_valid_page() { // Check data types. $this->assertInternalType( 'string', $result['userid'] ); - $this->assertInternalType( 'int', $result['page_id'] ); + $this->assertIsInt( $result['page_id'] ); $this->assertInternalType( 'string', $result['page_status'] ); $this->assertInternalType( 'string', $result['description'] ); $this->assertInternalType( 'string', $result['title'] ); @@ -56,14 +56,14 @@ function test_valid_page() { $this->assertIsArray( $result['categories'] ); $this->assertInternalType( 'string', $result['excerpt'] ); $this->assertInternalType( 'string', $result['text_more'] ); - $this->assertInternalType( 'int', $result['mt_allow_comments'] ); - $this->assertInternalType( 'int', $result['mt_allow_pings'] ); + $this->assertIsInt( $result['mt_allow_comments'] ); + $this->assertIsInt( $result['mt_allow_pings'] ); $this->assertInternalType( 'string', $result['wp_slug'] ); $this->assertInternalType( 'string', $result['wp_password'] ); $this->assertInternalType( 'string', $result['wp_author'] ); - $this->assertInternalType( 'int', $result['wp_page_parent_id'] ); + $this->assertIsInt( $result['wp_page_parent_id'] ); $this->assertInternalType( 'string', $result['wp_page_parent_title'] ); - $this->assertInternalType( 'int', $result['wp_page_order'] ); + $this->assertIsInt( $result['wp_page_order'] ); $this->assertInternalType( 'string', $result['wp_author_id'] ); $this->assertInternalType( 'string', $result['wp_author_display_name'] ); $this->assertIsArray( $result['custom_fields'] ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getPost.php b/tests/phpunit/tests/xmlrpc/wp/getPost.php index c3c0f5d63f048..d807c78cbf84b 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getPost.php +++ b/tests/phpunit/tests/xmlrpc/wp/getPost.php @@ -139,7 +139,7 @@ function test_valid_page() { $this->assertInternalType( 'string', $result['post_id'] ); $this->assertInternalType( 'string', $result['post_parent'] ); - $this->assertInternalType( 'int', $result['menu_order'] ); + $this->assertIsInt( $result['menu_order'] ); $this->assertInternalType( 'string', $result['guid'] ); $this->assertInternalType( 'string', $result['post_mime_type'] ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getPostType.php b/tests/phpunit/tests/xmlrpc/wp/getPostType.php index 5ba177db88a1e..335c0eda64f8e 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getPostType.php +++ b/tests/phpunit/tests/xmlrpc/wp/getPostType.php @@ -73,7 +73,7 @@ function test_valid_type() { $this->assertIsBool( $result['map_meta_cap'] ); $this->assertIsBool( $result['has_archive'] ); $this->assertIsBool( $result['show_ui'] ); - $this->assertInternalType( 'int', $result['menu_position'] ); + $this->assertIsInt( $result['menu_position'] ); $this->assertInternalType( 'string', $result['menu_icon'] ); $this->assertIsArray( $result['labels'] ); $this->assertIsArray( $result['cap'] ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getTerm.php b/tests/phpunit/tests/xmlrpc/wp/getTerm.php index 190725c3b872d..ec11a70effbb9 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getTerm.php +++ b/tests/phpunit/tests/xmlrpc/wp/getTerm.php @@ -83,7 +83,7 @@ function test_valid_term() { $this->assertInternalType( 'string', $result['slug'] ); $this->assertInternalType( 'string', $result['taxonomy'] ); $this->assertInternalType( 'string', $result['description'] ); - $this->assertInternalType( 'int', $result['count'] ); + $this->assertIsInt( $result['count'] ); // We expect all ID's to be strings not integers so we don't return something larger than an XMLRPC integer can describe. $this->assertStringMatchesFormat( '%d', $result['term_id'] ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getTerms.php b/tests/phpunit/tests/xmlrpc/wp/getTerms.php index 751b6c0c87560..6bd8cccd99f62 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getTerms.php +++ b/tests/phpunit/tests/xmlrpc/wp/getTerms.php @@ -48,7 +48,7 @@ function test_valid_terms() { $this->assertNotIXRError( $results ); foreach ( $results as $term ) { - $this->assertInternalType( 'int', $term['count'] ); + $this->assertIsInt( $term['count'] ); // Check custom term meta. $this->assertIsArray( $term['custom_fields'] );