diff --git a/tests/phpunit/tests/ajax/CustomizeManager.php b/tests/phpunit/tests/ajax/CustomizeManager.php index 581316e09b10..ca8bd74a370a 100644 --- a/tests/phpunit/tests/ajax/CustomizeManager.php +++ b/tests/phpunit/tests/ajax/CustomizeManager.php @@ -286,7 +286,7 @@ function test_save_success_publish_create() { ); $this->make_ajax_call( 'customize_save' ); $this->assertTrue( $this->_last_response_parsed['success'] ); - $this->assertInternalType( 'array', $this->_last_response_parsed['data'] ); + $this->assertIsArray( $this->_last_response_parsed['data'] ); $this->assertEquals( 'publish', $this->_last_response_parsed['data']['changeset_status'] ); $this->assertArrayHasKey( 'next_changeset_uuid', $this->_last_response_parsed['data'] ); @@ -325,7 +325,7 @@ function test_save_success_publish_edit() { $_POST['customize_changeset_title'] = 'Published'; $this->make_ajax_call( 'customize_save' ); $this->assertTrue( $this->_last_response_parsed['success'] ); - $this->assertInternalType( 'array', $this->_last_response_parsed['data'] ); + $this->assertIsArray( $this->_last_response_parsed['data'] ); $this->assertEquals( 'publish', $this->_last_response_parsed['data']['changeset_status'] ); $this->assertArrayHasKey( 'next_changeset_uuid', $this->_last_response_parsed['data'] ); diff --git a/tests/phpunit/tests/comment/query.php b/tests/phpunit/tests/comment/query.php index d7a50b52e66c..23f76c1294eb 100644 --- a/tests/phpunit/tests/comment/query.php +++ b/tests/phpunit/tests/comment/query.php @@ -3332,9 +3332,9 @@ public function test_comment_query_object() { $this->assertNull( $query1->query_vars ); $this->assertEmpty( $query1->comments ); $comments = $query1->query( array( 'status' => 'all' ) ); - $this->assertInternalType( 'array', $query1->query_vars ); + $this->assertIsArray( $query1->query_vars ); $this->assertNotEmpty( $query1->comments ); - $this->assertInternalType( 'array', $query1->comments ); + $this->assertIsArray( $query1->comments ); $query2 = new WP_Comment_Query( array( 'status' => 'all' ) ); $this->assertNotEmpty( $query2->query_vars ); diff --git a/tests/phpunit/tests/customize/custom-css-setting.php b/tests/phpunit/tests/customize/custom-css-setting.php index 0734a0b12079..bd7244918943 100644 --- a/tests/phpunit/tests/customize/custom-css-setting.php +++ b/tests/phpunit/tests/customize/custom-css-setting.php @@ -344,10 +344,10 @@ function test_update_filter() { * @return array Data. */ function filter_update_custom_css_data( $data, $args ) { - $this->assertInternalType( 'array', $data ); + $this->assertIsArray( $data ); $this->assertEqualSets( array( 'css', 'preprocessed' ), array_keys( $data ) ); $this->assertEquals( '', $data['preprocessed'] ); - $this->assertInternalType( 'array', $args ); + $this->assertIsArray( $args ); $this->assertEqualSets( array( 'css', 'preprocessed', 'stylesheet' ), array_keys( $args ) ); $this->assertEquals( $args['css'], $data['css'] ); $this->assertEquals( $args['preprocessed'], $data['preprocessed'] ); diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php index 6bb2525ea845..2b6fa4fac4e5 100644 --- a/tests/phpunit/tests/customize/manager.php +++ b/tests/phpunit/tests/customize/manager.php @@ -677,9 +677,9 @@ function test_import_theme_starter_content() { $this->assertEqualSets( $expected_setting_ids, array_keys( $changeset_values ) ); foreach ( array( 'widget_text[2]', 'widget_meta[3]' ) as $setting_id ) { - $this->assertInternalType( 'array', $changeset_values[ $setting_id ] ); + $this->assertIsArray( $changeset_values[ $setting_id ] ); $instance_data = $wp_customize->widgets->sanitize_widget_instance( $changeset_values[ $setting_id ] ); - $this->assertInternalType( 'array', $instance_data ); + $this->assertIsArray( $instance_data ); $this->assertArrayHasKey( 'title', $instance_data ); } @@ -787,7 +787,7 @@ function test_import_theme_starter_content() { $this->assertEquals( 'auto-draft', get_post( $posts_by_name['waffles'] )->post_status ); $this->assertNotEquals( $changeset_data['blogname']['value'], get_option( 'blogname' ) ); $r = $wp_customize->save_changeset_post( array( 'status' => 'publish' ) ); - $this->assertInternalType( 'array', $r ); + $this->assertIsArray( $r ); $this->assertEquals( 'publish', get_post( $posts_by_name['about'] )->post_status ); $this->assertEquals( 'inherit', get_post( $posts_by_name['waffles'] )->post_status ); $this->assertEquals( $changeset_data['blogname']['value'], get_option( 'blogname' ) ); @@ -1041,7 +1041,7 @@ function test_save_changeset_post_without_theme_activation() { 'data' => $pre_saved_data, ) ); - $this->assertInternalType( 'array', $r ); + $this->assertIsArray( $r ); $this->assertEquals( $did_action['customize_save_validation_before'] + 1, did_action( 'customize_save_validation_before' ) ); @@ -1098,7 +1098,7 @@ function test_save_changeset_post_without_theme_activation() { ); $this->assertInstanceOf( 'WP_Error', $r ); $this->assertEquals( 'transaction_fail', $r->get_error_code() ); - $this->assertInternalType( 'array', $r->get_error_data() ); + $this->assertIsArray( $r->get_error_data() ); $this->assertArrayHasKey( 'setting_validities', $r->get_error_data() ); $error_data = $r->get_error_data(); $this->assertArrayHasKey( 'blogname', $error_data['setting_validities'] ); @@ -1137,7 +1137,7 @@ function test_save_changeset_post_without_theme_activation() { ), ) ); - $this->assertInternalType( 'array', $r ); + $this->assertIsArray( $r ); $this->assertArrayHasKey( 'setting_validities', $r ); $this->assertTrue( $r['setting_validities']['blogname'] ); $this->assertInstanceOf( 'WP_Error', $r['setting_validities']['bar_unknown'] ); @@ -1204,7 +1204,7 @@ function test_save_changeset_post_without_theme_activation() { ), ) ); - $this->assertInternalType( 'array', $r ); + $this->assertIsArray( $r ); $this->assertEquals( 'Do it live \o/', get_option( 'blogname' ) ); $this->assertEquals( 'trash', get_post_status( $post_id ) ); // Auto-trashed. $this->assertEquals( $original_capabilities, wp_list_pluck( $manager->settings(), 'capability' ) ); @@ -1421,8 +1421,8 @@ public function filter_map_meta_cap_to_disallow_unfiltered_html( $caps, $cap ) { */ function filter_customize_changeset_save_data( $data, $context ) { $this->customize_changeset_save_data_call_count += 1; - $this->assertInternalType( 'array', $data ); - $this->assertInternalType( 'array', $context ); + $this->assertIsArray( $data ); + $this->assertIsArray( $context ); $this->assertArrayHasKey( 'uuid', $context ); $this->assertArrayHasKey( 'title', $context ); $this->assertArrayHasKey( 'status', $context ); @@ -1512,7 +1512,7 @@ function test_save_changeset_post_with_varying_users() { ), ) ); - $this->assertInternalType( 'array', $r ); + $this->assertIsArray( $r ); $this->assertEquals( array_fill_keys( array( 'blogname', 'scratchpad', 'background_color' ), true ), $r['setting_validities'] @@ -1539,7 +1539,7 @@ function test_save_changeset_post_with_varying_users() { ), ) ); - $this->assertInternalType( 'array', $r ); + $this->assertIsArray( $r ); $this->assertEquals( array_fill_keys( array( 'blogname', 'background_color' ), true ), $r['setting_validities'] @@ -1568,7 +1568,7 @@ function test_save_changeset_post_with_varying_users() { 'user_id' => self::$subscriber_user_id, ) ); - $this->assertInternalType( 'array', $r ); + $this->assertIsArray( $r ); $this->assertEquals( array_fill_keys( array( 'scratchpad', 'blogname' ), true ), $r['setting_validities'] @@ -1887,7 +1887,7 @@ public function test_save_changeset_post_with_autosave() { 'autosave' => true, ) ); - $this->assertInternalType( 'array', $r ); + $this->assertIsArray( $r ); // Verify that autosave happened. $autosave_revision = wp_get_post_autosave( $changeset_post_id, get_current_user_id() ); @@ -2714,10 +2714,10 @@ function test_prepare_setting_validity_for_js() { $error->add( 'bad_letter', 'Bad letra', 123 ); $error->add( 'bad_number', 'Bad number', array( 'number' => 123 ) ); $validity = $this->manager->prepare_setting_validity_for_js( $error ); - $this->assertInternalType( 'array', $validity ); + $this->assertIsArray( $validity ); foreach ( $error->errors as $code => $messages ) { $this->assertArrayHasKey( $code, $validity ); - $this->assertInternalType( 'array', $validity[ $code ] ); + $this->assertIsArray( $validity[ $code ] ); $this->assertEquals( join( ' ', $messages ), $validity[ $code ]['message'] ); $this->assertArrayHasKey( 'data', $validity[ $code ] ); $this->assertEquals( $validity[ $code ]['data'], $error->get_error_data( $code ) ); @@ -2927,7 +2927,7 @@ function filter_customize_dynamic_setting_args_for_test_dynamic_settings( $setti function filter_customize_dynamic_setting_class_for_test_dynamic_settings( $setting_class, $setting_id, $setting_args ) { $this->assertEquals( 'WP_Customize_Setting', $setting_class ); $this->assertInternalType( 'string', $setting_id ); - $this->assertInternalType( 'array', $setting_args ); + $this->assertIsArray( $setting_args ); return $setting_class; } @@ -3038,7 +3038,7 @@ function test_autofocus() { */ function test_nonces() { $nonces = $this->manager->get_nonces(); - $this->assertInternalType( 'array', $nonces ); + $this->assertIsArray( $nonces ); $this->assertArrayHasKey( 'save', $nonces ); $this->assertArrayHasKey( 'preview', $nonces ); @@ -3202,10 +3202,10 @@ function test_customize_loaded_components_filter() { * @return array Components. */ function return_array_containing_widgets( $components, $customize_manager ) { - $this->assertInternalType( 'array', $components ); + $this->assertIsArray( $components ); $this->assertContains( 'widgets', $components ); $this->assertContains( 'nav_menus', $components ); - $this->assertInternalType( 'array', $components ); + $this->assertIsArray( $components ); $this->assertInstanceOf( 'WP_Customize_Manager', $customize_manager ); return array( 'widgets' ); } @@ -3219,10 +3219,10 @@ function return_array_containing_widgets( $components, $customize_manager ) { * @return array Components. */ function return_array_containing_nav_menus( $components, $customize_manager ) { - $this->assertInternalType( 'array', $components ); + $this->assertIsArray( $components ); $this->assertContains( 'widgets', $components ); $this->assertContains( 'nav_menus', $components ); - $this->assertInternalType( 'array', $components ); + $this->assertIsArray( $components ); $this->assertInstanceOf( 'WP_Customize_Manager', $customize_manager ); return array( 'nav_menus' ); } diff --git a/tests/phpunit/tests/customize/nav-menu-item-setting.php b/tests/phpunit/tests/customize/nav-menu-item-setting.php index 5f581ff0102e..a066d24ee128 100644 --- a/tests/phpunit/tests/customize/nav-menu-item-setting.php +++ b/tests/phpunit/tests/customize/nav-menu-item-setting.php @@ -73,7 +73,7 @@ function test_construct() { $this->assertNull( $setting->previous_post_id ); $this->assertNull( $setting->update_status ); $this->assertNull( $setting->update_error ); - $this->assertInternalType( 'array', $setting->default ); + $this->assertIsArray( $setting->default ); $default = array( 'object_id' => 0, @@ -531,7 +531,7 @@ function test_sanitize() { ); foreach ( $valid_urls as $valid_url ) { $url_setting = $setting->sanitize( array( 'url' => $valid_url ) ); - $this->assertInternalType( 'array', $url_setting ); + $this->assertIsArray( $url_setting ); $this->assertEquals( $valid_url, $url_setting['url'] ); } diff --git a/tests/phpunit/tests/customize/nav-menu-setting.php b/tests/phpunit/tests/customize/nav-menu-setting.php index 53b0d88ac8db..bc29b49bcbcf 100644 --- a/tests/phpunit/tests/customize/nav-menu-setting.php +++ b/tests/phpunit/tests/customize/nav-menu-setting.php @@ -70,7 +70,7 @@ function test_construct() { $this->assertNull( $setting->previous_term_id ); $this->assertNull( $setting->update_status ); $this->assertNull( $setting->update_error ); - $this->assertInternalType( 'array', $setting->default ); + $this->assertIsArray( $setting->default ); foreach ( array( 'name', 'description', 'parent' ) as $key ) { $this->assertArrayHasKey( $key, $setting->default ); } @@ -149,7 +149,7 @@ function test_value() { $setting = new WP_Customize_Nav_Menu_Setting( $this->wp_customize, $setting_id ); $value = $setting->value(); - $this->assertInternalType( 'array', $value ); + $this->assertIsArray( $value ); foreach ( array( 'name', 'description', 'parent' ) as $key ) { $this->assertArrayHasKey( $key, $value ); } @@ -304,7 +304,7 @@ function test_preview_deleted() { $this->wp_customize->set_post_value( $setting_id, false ); - $this->assertInternalType( 'array', $setting->value() ); + $this->assertIsArray( $setting->value() ); $this->assertInternalType( 'object', wp_get_nav_menu_object( $menu_id ) ); $setting->preview(); $this->assertFalse( $setting->value() ); diff --git a/tests/phpunit/tests/customize/nav-menus.php b/tests/phpunit/tests/customize/nav-menus.php index 3698c818395d..4bae45353062 100644 --- a/tests/phpunit/tests/customize/nav-menus.php +++ b/tests/phpunit/tests/customize/nav-menus.php @@ -381,7 +381,7 @@ function test_search_available_items_query() { ) ); $this->assertEquals( $count + 1, $this->filter_count_customize_nav_menu_searched_items ); - $this->assertInternalType( 'array', $results ); + $this->assertIsArray( $results ); $this->assertCount( 3, $results ); remove_filter( 'customize_nav_menu_searched_items', array( $this, 'filter_search' ), 10 ); @@ -465,8 +465,8 @@ public function test_search_available_items_query_should_return_unassigned_term_ * @return array Items. */ function filter_search( $items, $args ) { - $this->assertInternalType( 'array', $items ); - $this->assertInternalType( 'array', $args ); + $this->assertIsArray( $items ); + $this->assertIsArray( $args ); $this->assertArrayHasKey( 's', $args ); $this->assertArrayHasKey( 'pagenum', $args ); $this->filter_count_customize_nav_menu_searched_items += 1; @@ -804,13 +804,13 @@ function test_customize_dynamic_partial_args() { do_action( 'customize_register', $this->wp_customize ); $args = apply_filters( 'customize_dynamic_partial_args', false, 'nav_menu_instance[68b329da9893e34099c7d8ad5cb9c940]' ); - $this->assertInternalType( 'array', $args ); + $this->assertIsArray( $args ); $this->assertEquals( 'nav_menu_instance', $args['type'] ); $this->assertEquals( array( $this->wp_customize->nav_menus, 'render_nav_menu_partial' ), $args['render_callback'] ); $this->assertTrue( $args['container_inclusive'] ); $args = apply_filters( 'customize_dynamic_partial_args', array( 'fallback_refresh' => false ), 'nav_menu_instance[4099c7d8ad5cb9c94068b329da9893e3]' ); - $this->assertInternalType( 'array', $args ); + $this->assertIsArray( $args ); $this->assertEquals( 'nav_menu_instance', $args['type'] ); $this->assertEquals( array( $this->wp_customize->nav_menus, 'render_nav_menu_partial' ), $args['render_callback'] ); $this->assertTrue( $args['container_inclusive'] ); diff --git a/tests/phpunit/tests/customize/partial.php b/tests/phpunit/tests/customize/partial.php index c8183d7be6a0..f6f14f501379 100644 --- a/tests/phpunit/tests/customize/partial.php +++ b/tests/phpunit/tests/customize/partial.php @@ -166,7 +166,7 @@ function test_id_data() { function filter_customize_partial_render( $rendered, $partial, $container_context ) { $this->assertTrue( false === $rendered || is_string( $rendered ) ); $this->assertInstanceOf( 'WP_Customize_Partial', $partial ); - $this->assertInternalType( 'array', $container_context ); + $this->assertIsArray( $container_context ); $this->count_filter_customize_partial_render += 1; return $rendered; } @@ -183,7 +183,7 @@ function filter_customize_partial_render_with_id( $rendered, $partial, $containe $this->assertEquals( sprintf( 'customize_partial_render_%s', $partial->id ), current_filter() ); $this->assertTrue( false === $rendered || is_string( $rendered ) ); $this->assertInstanceOf( 'WP_Customize_Partial', $partial ); - $this->assertInternalType( 'array', $container_context ); + $this->assertIsArray( $container_context ); $this->count_filter_customize_partial_render_with_id += 1; return $rendered; } diff --git a/tests/phpunit/tests/customize/selective-refresh-ajax.php b/tests/phpunit/tests/customize/selective-refresh-ajax.php index 2bd49e3d610e..d70505aad2b5 100644 --- a/tests/phpunit/tests/customize/selective-refresh-ajax.php +++ b/tests/phpunit/tests/customize/selective-refresh-ajax.php @@ -160,7 +160,7 @@ function test_handle_render_partials_request_for_unrecognized_partial() { } $output = json_decode( ob_get_clean(), true ); $this->assertTrue( $output['success'] ); - $this->assertInternalType( 'array', $output['data'] ); + $this->assertIsArray( $output['data'] ); $this->assertArrayHasKey( 'contents', $output['data'] ); $this->assertArrayHasKey( 'errors', $output['data'] ); $this->assertArrayHasKey( 'foo', $output['data']['contents'] ); @@ -280,7 +280,7 @@ function test_handle_rendering_partial_with_missing_settings() { * @return string */ function render_callback_blogname( $partial, $context ) { - $this->assertInternalType( 'array', $context ); + $this->assertIsArray( $context ); $this->assertInstanceOf( 'WP_Customize_Partial', $partial ); return get_bloginfo( 'name', 'display' ); } @@ -293,7 +293,7 @@ function render_callback_blogname( $partial, $context ) { * @return string */ function render_callback_blogdescription( $partial, $context ) { - $this->assertInternalType( 'array', $context ); + $this->assertIsArray( $context ); $this->assertInstanceOf( 'WP_Customize_Partial', $partial ); $x = get_bloginfo( 'description', 'display' ); return $x; @@ -374,7 +374,7 @@ function filter_customize_dynamic_partial_args( $partial_args, $partial_id ) { * @return array Response. */ function filter_customize_render_partials_response( $response, $component, $partial_placements ) { - $this->assertInternalType( 'array', $response ); + $this->assertIsArray( $response ); $this->assertInstanceOf( 'WP_Customize_Selective_Refresh', $component ); if ( isset( $this->expected_partial_ids ) ) { $this->assertEqualSets( $this->expected_partial_ids, array_keys( $partial_placements ) ); diff --git a/tests/phpunit/tests/customize/selective-refresh.php b/tests/phpunit/tests/customize/selective-refresh.php index ed4d9ef683c6..9f92dce9cde2 100644 --- a/tests/phpunit/tests/customize/selective-refresh.php +++ b/tests/phpunit/tests/customize/selective-refresh.php @@ -71,7 +71,7 @@ function test_register_scripts() { * @see WP_Customize_Selective_Refresh::partials() */ function test_partials() { - $this->assertInternalType( 'array', $this->selective_refresh->partials() ); + $this->assertIsArray( $this->selective_refresh->partials() ); } /** @@ -163,9 +163,9 @@ function test_export_preview_data() { $html = ob_get_clean(); $this->assertTrue( (bool) preg_match( '/_customizePartialRefreshExports = ({.+})/s', $html, $matches ) ); $exported_data = json_decode( $matches[1], true ); - $this->assertInternalType( 'array', $exported_data ); + $this->assertIsArray( $exported_data ); $this->assertArrayHasKey( 'partials', $exported_data ); - $this->assertInternalType( 'array', $exported_data['partials'] ); + $this->assertIsArray( $exported_data['partials'] ); $this->assertArrayHasKey( 'blogname', $exported_data['partials'] ); $this->assertArrayNotHasKey( 'top_secret_message', $exported_data['partials'] ); $this->assertEquals( '#site-title', $exported_data['partials']['blogname']['selector'] ); @@ -230,7 +230,7 @@ function filter_customize_dynamic_partial_args( $partial_args, $partial_id ) { * @return string */ function filter_customize_dynamic_partial_class( $partial_class, $partial_id, $partial_args ) { - $this->assertInternalType( 'array', $partial_args ); + $this->assertIsArray( $partial_args ); $this->assertInternalType( 'string', $partial_id ); $this->assertInternalType( 'string', $partial_class ); diff --git a/tests/phpunit/tests/customize/widgets.php b/tests/phpunit/tests/customize/widgets.php index 0b95c94b2b14..b5abb2dab73a 100644 --- a/tests/phpunit/tests/customize/widgets.php +++ b/tests/phpunit/tests/customize/widgets.php @@ -120,7 +120,7 @@ function test_get_selective_refreshable_widgets_when_theme_supports() { $this->do_customize_boot_actions(); $selective_refreshable_widgets = $this->manager->widgets->get_selective_refreshable_widgets(); - $this->assertInternalType( 'array', $selective_refreshable_widgets ); + $this->assertIsArray( $selective_refreshable_widgets ); $this->assertEquals( count( $wp_widget_factory->widgets ), count( $selective_refreshable_widgets ) ); $this->assertArrayHasKey( 'text', $selective_refreshable_widgets ); $this->assertTrue( $selective_refreshable_widgets['text'] ); @@ -493,7 +493,7 @@ function test_call_widget_update() { $this->assertArrayNotHasKey( $setting_id, $this->manager->unsanitized_post_values() ); $result = $this->manager->widgets->call_widget_update( $widget_id ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertArrayHasKey( 'instance', $result ); $this->assertArrayHasKey( 'form', $result ); $this->assertEquals( $instance, $result['instance'] ); @@ -502,7 +502,7 @@ function test_call_widget_update() { $post_values = $this->manager->unsanitized_post_values(); $this->assertArrayHasKey( $setting_id, $post_values ); $post_value = $post_values[ $setting_id ]; - $this->assertInternalType( 'array', $post_value ); + $this->assertIsArray( $post_value ); $this->assertArrayHasKey( 'title', $post_value ); $this->assertArrayHasKey( 'encoded_serialized_instance', $post_value ); $this->assertArrayHasKey( 'instance_hash_key', $post_value ); @@ -519,13 +519,13 @@ function test_customize_dynamic_partial_args() { do_action( 'customize_register', $this->manager ); $args = apply_filters( 'customize_dynamic_partial_args', false, 'widget[search-2]' ); - $this->assertInternalType( 'array', $args ); + $this->assertIsArray( $args ); $this->assertEquals( 'widget', $args['type'] ); $this->assertEquals( array( $this->manager->widgets, 'render_widget_partial' ), $args['render_callback'] ); $this->assertTrue( $args['container_inclusive'] ); $args = apply_filters( 'customize_dynamic_partial_args', array( 'fallback_refresh' => false ), 'widget[search-2]' ); - $this->assertInternalType( 'array', $args ); + $this->assertIsArray( $args ); $this->assertEquals( 'widget', $args['type'] ); $this->assertEquals( array( $this->manager->widgets, 'render_widget_partial' ), $args['render_callback'] ); $this->assertTrue( $args['container_inclusive'] ); diff --git a/tests/phpunit/tests/db.php b/tests/phpunit/tests/db.php index 26346f2df0ba..37232065e105 100644 --- a/tests/phpunit/tests/db.php +++ b/tests/phpunit/tests/db.php @@ -1690,7 +1690,7 @@ public function test_parse_db_host( $host_string, $expect_bail, $host, $port, $s if ( $expect_bail ) { $this->assertFalse( $data ); } else { - $this->assertInternalType( 'array', $data ); + $this->assertIsArray( $data ); list( $parsed_host, $parsed_port, $parsed_socket, $parsed_is_ipv6 ) = $data; diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php index ad7ba280d974..734f1daa04df 100644 --- a/tests/phpunit/tests/functions.php +++ b/tests/phpunit/tests/functions.php @@ -557,17 +557,17 @@ function test_add_query_arg_numeric_keys() { function test_get_allowed_mime_types() { $mimes = get_allowed_mime_types(); - $this->assertInternalType( 'array', $mimes ); + $this->assertIsArray( $mimes ); $this->assertNotEmpty( $mimes ); add_filter( 'upload_mimes', '__return_empty_array' ); $mimes = get_allowed_mime_types(); - $this->assertInternalType( 'array', $mimes ); + $this->assertIsArray( $mimes ); $this->assertEmpty( $mimes ); remove_filter( 'upload_mimes', '__return_empty_array' ); $mimes = get_allowed_mime_types(); - $this->assertInternalType( 'array', $mimes ); + $this->assertIsArray( $mimes ); $this->assertNotEmpty( $mimes ); } @@ -577,28 +577,28 @@ function test_get_allowed_mime_types() { function test_wp_get_mime_types() { $mimes = wp_get_mime_types(); - $this->assertInternalType( 'array', $mimes ); + $this->assertIsArray( $mimes ); $this->assertNotEmpty( $mimes ); add_filter( 'mime_types', '__return_empty_array' ); $mimes = wp_get_mime_types(); - $this->assertInternalType( 'array', $mimes ); + $this->assertIsArray( $mimes ); $this->assertEmpty( $mimes ); remove_filter( 'mime_types', '__return_empty_array' ); $mimes = wp_get_mime_types(); - $this->assertInternalType( 'array', $mimes ); + $this->assertIsArray( $mimes ); $this->assertNotEmpty( $mimes ); // 'upload_mimes' should not affect wp_get_mime_types(). add_filter( 'upload_mimes', '__return_empty_array' ); $mimes = wp_get_mime_types(); - $this->assertInternalType( 'array', $mimes ); + $this->assertIsArray( $mimes ); $this->assertNotEmpty( $mimes ); remove_filter( 'upload_mimes', '__return_empty_array' ); $mimes2 = wp_get_mime_types(); - $this->assertInternalType( 'array', $mimes2 ); + $this->assertIsArray( $mimes2 ); $this->assertNotEmpty( $mimes2 ); $this->assertEquals( $mimes2, $mimes ); } @@ -886,7 +886,7 @@ function test_wp_extract_urls() { $urls = wp_extract_urls( $blob ); $this->assertNotEmpty( $urls ); - $this->assertInternalType( 'array', $urls ); + $this->assertIsArray( $urls ); $this->assertCount( count( $original_urls ), $urls ); $this->assertEquals( $original_urls, $urls ); @@ -907,7 +907,7 @@ function test_wp_extract_urls() { $urls = wp_extract_urls( $blob ); $this->assertNotEmpty( $urls ); - $this->assertInternalType( 'array', $urls ); + $this->assertIsArray( $urls ); $this->assertCount( 8, $urls ); $this->assertEquals( array_slice( $original_urls, 0, 8 ), $urls ); @@ -921,7 +921,7 @@ function test_wp_extract_urls() { $urls = wp_extract_urls( $blob ); $this->assertNotEmpty( $urls ); - $this->assertInternalType( 'array', $urls ); + $this->assertIsArray( $urls ); $this->assertCount( 8, $urls ); $this->assertEquals( array_slice( $original_urls, 0, 8 ), $urls ); } @@ -1048,7 +1048,7 @@ function datetime_provider() { public function test_wp_get_ext_types() { $extensions = wp_get_ext_types(); - $this->assertInternalType( 'array', $extensions ); + $this->assertIsArray( $extensions ); $this->assertNotEmpty( $extensions ); add_filter( 'ext2type', '__return_empty_array' ); @@ -1057,7 +1057,7 @@ public function test_wp_get_ext_types() { remove_filter( 'ext2type', '__return_empty_array' ); $extensions = wp_get_ext_types(); - $this->assertInternalType( 'array', $extensions ); + $this->assertIsArray( $extensions ); $this->assertNotEmpty( $extensions ); } diff --git a/tests/phpunit/tests/functions/listFiles.php b/tests/phpunit/tests/functions/listFiles.php index d461e0c19581..15e4befe7c97 100644 --- a/tests/phpunit/tests/functions/listFiles.php +++ b/tests/phpunit/tests/functions/listFiles.php @@ -8,7 +8,7 @@ class Tests_Functions_ListFiles extends WP_UnitTestCase { public function test_list_files_returns_a_list_of_files() { $admin_files = list_files( ABSPATH . 'wp-admin/' ); - $this->assertInternalType( 'array', $admin_files ); + $this->assertIsArray( $admin_files ); $this->assertNotEmpty( $admin_files ); $this->assertContains( ABSPATH . 'wp-admin/index.php', $admin_files ); } diff --git a/tests/phpunit/tests/functions/wpGetMimeTypes.php b/tests/phpunit/tests/functions/wpGetMimeTypes.php index 8188ecd51831..23d7733ea7a6 100644 --- a/tests/phpunit/tests/functions/wpGetMimeTypes.php +++ b/tests/phpunit/tests/functions/wpGetMimeTypes.php @@ -13,7 +13,7 @@ class Tests_Functions_wpGetMimeTypes extends WP_UnitTestCase { public function test_all_mime_match() { $mime_types_start = wp_get_mime_types(); - $this->assertInternalType( 'array', $mime_types_start ); + $this->assertIsArray( $mime_types_start ); $this->assertNotEmpty( $mime_types_start ); add_filter( 'mime_types', '__return_empty_array' ); @@ -22,7 +22,7 @@ public function test_all_mime_match() { remove_filter( 'mime_types', '__return_empty_array' ); $mime_types = wp_get_mime_types(); - $this->assertInternalType( 'array', $mime_types ); + $this->assertIsArray( $mime_types ); $this->assertNotEmpty( $mime_types ); // Did it revert to the original after filter remove? $this->assertSame( $mime_types_start, $mime_types ); diff --git a/tests/phpunit/tests/http/base.php b/tests/phpunit/tests/http/base.php index 5100fd6117c3..15bc1731e451 100644 --- a/tests/phpunit/tests/http/base.php +++ b/tests/phpunit/tests/http/base.php @@ -403,7 +403,7 @@ function test_multiple_location_headers() { $res = wp_remote_head( $url, array( 'timeout' => 30 ) ); $this->skipTestOnTimeout( $res ); - $this->assertInternalType( 'array', wp_remote_retrieve_header( $res, 'location' ) ); + $this->assertIsArray( wp_remote_retrieve_header( $res, 'location' ) ); $this->assertCount( 2, wp_remote_retrieve_header( $res, 'location' ) ); $res = wp_remote_get( $url, array( 'timeout' => 30 ) ); diff --git a/tests/phpunit/tests/http/functions.php b/tests/phpunit/tests/http/functions.php index 66cb6b52fe4d..3029aba74697 100644 --- a/tests/phpunit/tests/http/functions.php +++ b/tests/phpunit/tests/http/functions.php @@ -23,7 +23,7 @@ function test_head_request() { $headers = wp_remote_retrieve_headers( $response ); - $this->assertInternalType( 'array', $response ); + $this->assertIsArray( $response ); $this->assertEquals( 'image/jpeg', $headers['content-type'] ); $this->assertEquals( '40148', $headers['content-length'] ); @@ -56,7 +56,7 @@ function test_get_request() { $headers = wp_remote_retrieve_headers( $response ); - $this->assertInternalType( 'array', $response ); + $this->assertIsArray( $response ); // Should return the same headers as a HEAD request. $this->assertEquals( 'image/jpeg', $headers['content-type'] ); diff --git a/tests/phpunit/tests/image/intermediateSize.php b/tests/phpunit/tests/image/intermediateSize.php index 394353c6508d..1c354605cb57 100644 --- a/tests/phpunit/tests/image/intermediateSize.php +++ b/tests/phpunit/tests/image/intermediateSize.php @@ -35,7 +35,7 @@ function test_make_intermediate_size_width() { $image = image_make_intermediate_size( DIR_TESTDATA . '/images/a2-small.jpg', 100, 0, false ); - $this->assertInternalType( 'array', $image ); + $this->assertIsArray( $image ); } function test_make_intermediate_size_height() { @@ -45,7 +45,7 @@ function test_make_intermediate_size_height() { $image = image_make_intermediate_size( DIR_TESTDATA . '/images/a2-small.jpg', 0, 75, false ); - $this->assertInternalType( 'array', $image ); + $this->assertIsArray( $image ); } function test_make_intermediate_size_successful() { @@ -55,7 +55,7 @@ function test_make_intermediate_size_successful() { $image = image_make_intermediate_size( DIR_TESTDATA . '/images/a2-small.jpg', 100, 75, true ); - $this->assertInternalType( 'array', $image ); + $this->assertIsArray( $image ); $this->assertEquals( 100, $image['width'] ); $this->assertEquals( 75, $image['height'] ); $this->assertEquals( 'image/jpeg', $image['mime-type'] ); diff --git a/tests/phpunit/tests/l10n.php b/tests/phpunit/tests/l10n.php index 381b865557ba..94406697a4d2 100644 --- a/tests/phpunit/tests/l10n.php +++ b/tests/phpunit/tests/l10n.php @@ -56,7 +56,7 @@ function test_before_last_bar() { */ function test_get_available_languages() { $array = get_available_languages(); - $this->assertInternalType( 'array', $array ); + $this->assertIsArray( $array ); $array = get_available_languages( '.' ); $this->assertEmpty( $array ); @@ -70,7 +70,7 @@ function test_get_available_languages() { */ function test_wp_get_installed_translations_for_core() { $installed_translations = wp_get_installed_translations( 'core' ); - $this->assertInternalType( 'array', $installed_translations ); + $this->assertIsArray( $installed_translations ); $textdomains_expected = array( 'admin', 'admin-network', 'continents-cities', 'default' ); $this->assertEqualSets( $textdomains_expected, array_keys( $installed_translations ) ); diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index 34a1414da3b5..6b6b1d82f955 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -349,7 +349,7 @@ function test_wp_prepare_attachment_for_js() { $post = get_post( $id ); $prepped = wp_prepare_attachment_for_js( $post ); - $this->assertInternalType( 'array', $prepped ); + $this->assertIsArray( $prepped ); $this->assertEquals( 0, $prepped['uploadedTo'] ); $this->assertEquals( '', $prepped['mime'] ); $this->assertEquals( '', $prepped['type'] ); diff --git a/tests/phpunit/tests/oembed/controller.php b/tests/phpunit/tests/oembed/controller.php index 023f82fd1192..a0603f961299 100644 --- a/tests/phpunit/tests/oembed/controller.php +++ b/tests/phpunit/tests/oembed/controller.php @@ -169,7 +169,7 @@ public function filter_oembed_result( $data, $url, $args ) { $this->fail( 'Unexpected type for $data.' ); } $this->assertInternalType( 'string', $url ); - $this->assertInternalType( 'array', $args ); + $this->assertIsArray( $args ); $this->oembed_result_filter_count++; return $data; } @@ -298,7 +298,7 @@ function test_request_invalid_format() { $response = rest_get_server()->dispatch( $request ); $data = $response->get_data(); - $this->assertInternalType( 'array', $data ); + $this->assertIsArray( $data ); $this->assertNotEmpty( $data ); } @@ -322,7 +322,7 @@ function test_request_json() { $response = rest_get_server()->dispatch( $request ); $data = $response->get_data(); - $this->assertInternalType( 'array', $data ); + $this->assertIsArray( $data ); $this->assertNotEmpty( $data ); $this->assertArrayHasKey( 'version', $data ); @@ -365,7 +365,7 @@ function test_request_static_front_page() { $response = rest_get_server()->dispatch( $request ); $data = $response->get_data(); - $this->assertInternalType( 'array', $data ); + $this->assertIsArray( $data ); $this->assertNotEmpty( $data ); $this->assertArrayHasKey( 'version', $data ); @@ -410,7 +410,7 @@ function test_request_xml() { $response = rest_get_server()->dispatch( $request ); $data = $response->get_data(); - $this->assertInternalType( 'array', $data ); + $this->assertIsArray( $data ); $this->assertNotEmpty( $data ); $this->assertArrayHasKey( 'version', $data ); @@ -453,7 +453,7 @@ function test_request_ms_child_in_root_blog() { $response = rest_get_server()->dispatch( $request ); $data = $response->get_data(); - $this->assertInternalType( 'array', $data ); + $this->assertIsArray( $data ); $this->assertNotEmpty( $data ); restore_current_blog(); @@ -631,7 +631,7 @@ public function test_proxy_with_classic_embed_provider() { $this->assertNotEmpty( $data ); $this->assertInternalType( 'object', $data ); $this->assertInternalType( 'string', $data->html ); - $this->assertInternalType( 'array', $data->scripts ); + $this->assertIsArray( $data->scripts ); } public function test_proxy_with_invalid_oembed_provider_no_discovery() { diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php index aedbe404bc75..cea1d2fe8af9 100644 --- a/tests/phpunit/tests/post.php +++ b/tests/phpunit/tests/post.php @@ -97,12 +97,12 @@ function test_vb_insert_get_delete() { update_object_term_cache( $id, $post_type ); $tcache = wp_cache_get( $id, 'post_tag_relationships' ); - $this->assertInternalType( 'array', $tcache ); + $this->assertIsArray( $tcache ); $this->assertEquals( 2, count( $tcache ) ); $tcache = wp_cache_get( $id, 'ctax_relationships' ); if ( 'cpt' === $post_type ) { - $this->assertInternalType( 'array', $tcache ); + $this->assertIsArray( $tcache ); $this->assertEquals( 2, count( $tcache ) ); } else { $this->assertFalse( $tcache ); diff --git a/tests/phpunit/tests/post/formats.php b/tests/phpunit/tests/post/formats.php index e32fc847b91b..f86687b3e094 100644 --- a/tests/phpunit/tests/post/formats.php +++ b/tests/phpunit/tests/post/formats.php @@ -16,7 +16,7 @@ function test_set_get_post_format_for_post() { $result = set_post_format( $post_id, 'aside' ); $this->assertNotWPError( $result ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( 1, count( $result ) ); $format = get_post_format( $post_id ); @@ -24,12 +24,12 @@ function test_set_get_post_format_for_post() { $result = set_post_format( $post_id, 'standard' ); $this->assertNotWPError( $result ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( 0, count( $result ) ); $result = set_post_format( $post_id, '' ); $this->assertNotWPError( $result ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( 0, count( $result ) ); } @@ -44,7 +44,7 @@ function test_set_get_post_format_for_page() { $result = set_post_format( $post_id, 'aside' ); $this->assertNotWPError( $result ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( 1, count( $result ) ); // The format can be set but not retrieved until it is registered. $format = get_post_format( $post_id ); @@ -57,12 +57,12 @@ function test_set_get_post_format_for_page() { $result = set_post_format( $post_id, 'standard' ); $this->assertNotWPError( $result ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( 0, count( $result ) ); $result = set_post_format( $post_id, '' ); $this->assertNotWPError( $result ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( 0, count( $result ) ); remove_post_type_support( 'page', 'post-formats' ); @@ -76,13 +76,13 @@ function test_has_format() { $result = set_post_format( $post_id, 'aside' ); $this->assertNotWPError( $result ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( 1, count( $result ) ); $this->assertTrue( has_post_format( 'aside', $post_id ) ); $result = set_post_format( $post_id, 'standard' ); $this->assertNotWPError( $result ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( 0, count( $result ) ); // Standard is a special case. It shows as false when set. $this->assertFalse( has_post_format( 'standard', $post_id ) ); diff --git a/tests/phpunit/tests/post/getPageByPath.php b/tests/phpunit/tests/post/getPageByPath.php index 9b288b64f64b..f5fe67b4457a 100644 --- a/tests/phpunit/tests/post/getPageByPath.php +++ b/tests/phpunit/tests/post/getPageByPath.php @@ -310,11 +310,11 @@ public function test_output_param_should_be_obeyed_for_cached_value() { $this->assertSame( $page, $object->ID ); $array_n = get_page_by_path( 'foo', ARRAY_N ); - $this->assertInternalType( 'array', $array_n ); + $this->assertIsArray( $array_n ); $this->assertSame( $page, $array_n[0] ); $array_a = get_page_by_path( 'foo', ARRAY_A ); - $this->assertInternalType( 'array', $array_a ); + $this->assertIsArray( $array_a ); $this->assertSame( $page, $array_a['ID'] ); } } diff --git a/tests/phpunit/tests/post/objects.php b/tests/phpunit/tests/post/objects.php index 5451f73b542f..8b03053302c8 100644 --- a/tests/phpunit/tests/post/objects.php +++ b/tests/phpunit/tests/post/objects.php @@ -30,17 +30,17 @@ function test_get_post() { // Excercise the output argument. $post = get_post( $id, ARRAY_A ); - $this->assertInternalType( 'array', $post ); + $this->assertIsArray( $post ); $this->assertEquals( 'post', $post['post_type'] ); $post = get_post( $id, ARRAY_N ); - $this->assertInternalType( 'array', $post ); + $this->assertIsArray( $post ); $this->assertFalse( isset( $post['post_type'] ) ); $this->assertTrue( in_array( 'post', $post, true ) ); $post = get_post( $id ); $post = get_post( $post, ARRAY_A ); - $this->assertInternalType( 'array', $post ); + $this->assertIsArray( $post ); $this->assertEquals( 'post', $post['post_type'] ); $this->assertEquals( $id, $post['ID'] ); @@ -51,7 +51,7 @@ function test_get_post() { // Make sure stdClass in $GLOBALS['post'] is handled. $post_std = $post->to_array(); - $this->assertInternalType( 'array', $post_std ); + $this->assertIsArray( $post_std ); $post_std = (object) $post_std; $GLOBALS['post'] = $post_std; $post = get_post( null ); @@ -103,7 +103,7 @@ function test_get_post_ancestors() { */ function test_get_post_ancestors_with_falsey_values() { foreach ( array( null, 0, false, '0', '' ) as $post_id ) { - $this->assertInternalType( 'array', get_post_ancestors( $post_id ) ); + $this->assertIsArray( get_post_ancestors( $post_id ) ); $this->assertEquals( array(), get_post_ancestors( $post_id ) ); } } @@ -112,7 +112,7 @@ function test_get_post_category_property() { $post_id = self::factory()->post->create(); $post = get_post( $post_id ); - $this->assertInternalType( 'array', $post->post_category ); + $this->assertIsArray( $post->post_category ); $this->assertEquals( 1, count( $post->post_category ) ); $this->assertEquals( get_option( 'default_category' ), $post->post_category[0] ); $term1 = wp_insert_term( 'Foo', 'category' ); @@ -131,15 +131,15 @@ function test_get_tags_input_property() { $post_id = self::factory()->post->create(); $post = get_post( $post_id ); - $this->assertInternalType( 'array', $post->tags_input ); + $this->assertIsArray( $post->tags_input ); $this->assertEmpty( $post->tags_input ); wp_set_post_tags( $post_id, 'Foo, Bar, Baz' ); - $this->assertInternalType( 'array', $post->tags_input ); + $this->assertIsArray( $post->tags_input ); $this->assertEquals( 3, count( $post->tags_input ) ); $this->assertEquals( array( 'Bar', 'Baz', 'Foo' ), $post->tags_input ); $post = get_post( $post_id, ARRAY_A ); - $this->assertInternalType( 'array', $post['tags_input'] ); + $this->assertIsArray( $post['tags_input'] ); $this->assertEquals( 3, count( $post['tags_input'] ) ); $this->assertEquals( array( 'Bar', 'Baz', 'Foo' ), $post['tags_input'] ); } @@ -199,7 +199,7 @@ function test_get_post_array() { $post = get_post( $id, ARRAY_A ); $this->assertEquals( $id, $post['ID'] ); - $this->assertInternalType( 'array', $post['ancestors'] ); + $this->assertIsArray( $post['ancestors'] ); $this->assertEquals( 'raw', $post['filter'] ); } diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php index 3ace6d6da61f..36f8516f4380 100644 --- a/tests/phpunit/tests/rest-api/rest-comments-controller.php +++ b/tests/phpunit/tests/rest-api/rest-comments-controller.php @@ -2833,7 +2833,7 @@ public function verify_comment_roundtrip( $input = array(), $expected_output = a $actual_output = $response->get_data(); // Compare expected API output to actual API output. - $this->assertInternalType( 'array', $actual_output['content'] ); + $this->assertIsArray( $actual_output['content'] ); $this->assertArrayHasKey( 'raw', $actual_output['content'] ); $this->assertEquals( $expected_output['content']['raw'], $actual_output['content']['raw'] ); $this->assertEquals( $expected_output['content']['rendered'], trim( $actual_output['content']['rendered'] ) ); diff --git a/tests/phpunit/tests/rest-api/rest-post-meta-fields.php b/tests/phpunit/tests/rest-api/rest-post-meta-fields.php index 6cdb9743c7ed..cd73a83e2251 100644 --- a/tests/phpunit/tests/rest-api/rest-post-meta-fields.php +++ b/tests/phpunit/tests/rest-api/rest-post-meta-fields.php @@ -290,7 +290,7 @@ public function test_get_multi_value() { $data = $response->get_data(); $meta = (array) $data['meta']; $this->assertArrayHasKey( 'test_multi', $meta ); - $this->assertInternalType( 'array', $meta['test_multi'] ); + $this->assertIsArray( $meta['test_multi'] ); $this->assertContains( 'value1', $meta['test_multi'] ); // Check after an update. @@ -1211,7 +1211,7 @@ public function test_get_subtype_meta_value( $post_type, $meta_key, $single, $in $data = $response->get_data(); $this->assertArrayHasKey( 'meta', $data ); - $this->assertInternalType( 'array', $data['meta'] ); + $this->assertIsArray( $data['meta'] ); if ( $in_post_type ) { $expected_value = $meta_value; @@ -1277,7 +1277,7 @@ public function test_set_subtype_meta_value( $post_type, $meta_key, $single, $in $data = $response->get_data(); $this->assertArrayHasKey( 'meta', $data ); - $this->assertInternalType( 'array', $data['meta'] ); + $this->assertIsArray( $data['meta'] ); if ( $in_post_type ) { $expected_value = $meta_value; diff --git a/tests/phpunit/tests/rest-api/rest-server.php b/tests/phpunit/tests/rest-api/rest-server.php index b9fd3db750ed..a00d3ff509f1 100644 --- a/tests/phpunit/tests/rest-api/rest-server.php +++ b/tests/phpunit/tests/rest-api/rest-server.php @@ -532,7 +532,7 @@ public function test_link_embedding() { $this->assertCount( 2, $alternate ); $this->assertEmpty( $alternate[0] ); - $this->assertInternalType( 'array', $alternate[1] ); + $this->assertIsArray( $alternate[1] ); $this->assertArrayNotHasKey( 'code', $alternate[1] ); $this->assertTrue( $alternate[1]['hello'] ); diff --git a/tests/phpunit/tests/rest-api/rest-term-meta-fields.php b/tests/phpunit/tests/rest-api/rest-term-meta-fields.php index bf9a26d854b4..9e882e9bd1d3 100644 --- a/tests/phpunit/tests/rest-api/rest-term-meta-fields.php +++ b/tests/phpunit/tests/rest-api/rest-term-meta-fields.php @@ -237,7 +237,7 @@ public function test_get_multi_value() { $data = $response->get_data(); $meta = (array) $data['meta']; $this->assertArrayHasKey( 'test_multi', $meta ); - $this->assertInternalType( 'array', $meta['test_multi'] ); + $this->assertIsArray( $meta['test_multi'] ); $this->assertContains( 'value1', $meta['test_multi'] ); // Check after an update. @@ -1157,7 +1157,7 @@ public function test_get_subtype_meta_value( $taxonomy, $meta_key, $single, $in_ $data = $response->get_data(); $this->assertArrayHasKey( 'meta', $data ); - $this->assertInternalType( 'array', $data['meta'] ); + $this->assertIsArray( $data['meta'] ); if ( $in_taxonomy ) { $expected_value = $meta_value; @@ -1221,7 +1221,7 @@ public function test_set_subtype_meta_value( $taxonomy, $meta_key, $single, $in_ $data = $response->get_data(); $this->assertArrayHasKey( 'meta', $data ); - $this->assertInternalType( 'array', $data['meta'] ); + $this->assertIsArray( $data['meta'] ); if ( $in_taxonomy ) { $expected_value = $meta_value; diff --git a/tests/phpunit/tests/rest-api/rest-users-controller.php b/tests/phpunit/tests/rest-api/rest-users-controller.php index 98edd36ee396..d0f136f00407 100644 --- a/tests/phpunit/tests/rest-api/rest-users-controller.php +++ b/tests/phpunit/tests/rest-api/rest-users-controller.php @@ -1211,13 +1211,13 @@ public function test_create_item_invalid_username() { $data = $response->get_data(); if ( is_multisite() ) { - $this->assertInternalType( 'array', $data['additional_errors'] ); + $this->assertIsArray( $data['additional_errors'] ); $this->assertCount( 1, $data['additional_errors'] ); $error = $data['additional_errors'][0]; $this->assertEquals( 'user_name', $error['code'] ); $this->assertEquals( 'Usernames can only contain lowercase letters (a-z) and numbers.', $error['message'] ); } else { - $this->assertInternalType( 'array', $data['data']['params'] ); + $this->assertIsArray( $data['data']['params'] ); $errors = $data['data']['params']; $this->assertInternalType( 'string', $errors['username'] ); $this->assertEquals( 'This username is invalid because it uses illegal characters. Please enter a valid username.', $errors['username'] ); @@ -1257,7 +1257,7 @@ public function test_create_item_illegal_username() { $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); $data = $response->get_data(); - $this->assertInternalType( 'array', $data['data']['params'] ); + $this->assertIsArray( $data['data']['params'] ); $errors = $data['data']['params']; $this->assertInternalType( 'string', $errors['username'] ); $this->assertEquals( 'Sorry, that username is not allowed.', $errors['username'] ); @@ -1381,7 +1381,7 @@ public function test_create_existing_network_user_on_sub_site_has_error() { $this->assertErrorResponse( 'rest_invalid_param', $switched_response, 400 ); $data = $switched_response->get_data(); - $this->assertInternalType( 'array', $data['additional_errors'] ); + $this->assertIsArray( $data['additional_errors'] ); $this->assertCount( 2, $data['additional_errors'] ); $errors = $data['additional_errors']; foreach ( $errors as $error ) { diff --git a/tests/phpunit/tests/rewrite.php b/tests/phpunit/tests/rewrite.php index bb01ae8d805d..e4e140e0a6d6 100644 --- a/tests/phpunit/tests/rewrite.php +++ b/tests/phpunit/tests/rewrite.php @@ -482,7 +482,7 @@ public function test_flush_rules_does_not_delete_option() { $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); $rewrite_rules = get_option( 'rewrite_rules' ); - $this->assertInternalType( 'array', $rewrite_rules ); + $this->assertIsArray( $rewrite_rules ); $this->assertNotEmpty( $rewrite_rules ); } } diff --git a/tests/phpunit/tests/rewrite/permastructs.php b/tests/phpunit/tests/rewrite/permastructs.php index 859af86cc619..8a528ef3cc84 100644 --- a/tests/phpunit/tests/rewrite/permastructs.php +++ b/tests/phpunit/tests/rewrite/permastructs.php @@ -34,7 +34,7 @@ public function test_remove_permastruct() { global $wp_rewrite; add_permastruct( 'foo', 'bar/%foo%' ); - $this->assertInternalType( 'array', $wp_rewrite->extra_permastructs['foo'] ); + $this->assertIsArray( $wp_rewrite->extra_permastructs['foo'] ); $this->assertSame( '/bar/%foo%', $wp_rewrite->extra_permastructs['foo']['struct'] ); remove_permastruct( 'foo' ); diff --git a/tests/phpunit/tests/taxonomy.php b/tests/phpunit/tests/taxonomy.php index e8fcffc8d9da..a6fd7e04ed28 100644 --- a/tests/phpunit/tests/taxonomy.php +++ b/tests/phpunit/tests/taxonomy.php @@ -840,7 +840,7 @@ public function test_unregister_taxonomy_removes_permastruct() { ) ); - $this->assertInternalType( 'array', $wp_rewrite->extra_permastructs['foo'] ); + $this->assertIsArray( $wp_rewrite->extra_permastructs['foo'] ); $this->assertTrue( unregister_taxonomy( 'foo' ) ); $this->assertFalse( isset( $wp_rewrite->extra_permastructs['foo'] ) ); } diff --git a/tests/phpunit/tests/term.php b/tests/phpunit/tests/term.php index 08c08f8a7c9e..87a3d950156d 100644 --- a/tests/phpunit/tests/term.php +++ b/tests/phpunit/tests/term.php @@ -53,7 +53,7 @@ function test_is_term_type() { // Insert a term. $term = rand_str(); $t = wp_insert_term( $term, $this->taxonomy ); - $this->assertInternalType( 'array', $t ); + $this->assertIsArray( $t ); $term_obj = get_term_by( 'name', $term, $this->taxonomy ); $this->assertEquals( $t['term_id'], term_exists( $term_obj->slug ) ); @@ -109,9 +109,9 @@ function test_term_is_ancestor_of() { $term2 = rand_str(); $t = wp_insert_term( $term, 'category' ); - $this->assertInternalType( 'array', $t ); + $this->assertIsArray( $t ); $t2 = wp_insert_term( $term, 'category', array( 'parent' => $t['term_id'] ) ); - $this->assertInternalType( 'array', $t2 ); + $this->assertIsArray( $t2 ); if ( function_exists( 'term_is_ancestor_of' ) ) { $this->assertTrue( term_is_ancestor_of( $t['term_id'], $t2['term_id'], 'category' ) ); $this->assertFalse( term_is_ancestor_of( $t2['term_id'], $t['term_id'], 'category' ) ); @@ -153,7 +153,7 @@ function test_wp_set_post_categories() { $post_id = self::$post_ids[0]; $post = get_post( $post_id ); - $this->assertInternalType( 'array', $post->post_category ); + $this->assertIsArray( $post->post_category ); $this->assertEquals( 1, count( $post->post_category ) ); $this->assertEquals( get_option( 'default_category' ), $post->post_category[0] ); diff --git a/tests/phpunit/tests/term/getTerm.php b/tests/phpunit/tests/term/getTerm.php index 15052589c14c..5d557bf3d02e 100644 --- a/tests/phpunit/tests/term/getTerm.php +++ b/tests/phpunit/tests/term/getTerm.php @@ -103,14 +103,14 @@ public function test_output_object() { public function test_output_array_a() { $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); $term = get_term( $t, 'wptests_tax', ARRAY_A ); - $this->assertInternalType( 'array', $term ); + $this->assertIsArray( $term ); $this->assertTrue( isset( $term['term_id'] ) ); } public function test_output_array_n() { $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); $term = get_term( $t, 'wptests_tax', ARRAY_N ); - $this->assertInternalType( 'array', $term ); + $this->assertIsArray( $term ); $this->assertFalse( isset( $term['term_id'] ) ); foreach ( $term as $k => $v ) { $this->assertInternalType( 'integer', $k ); diff --git a/tests/phpunit/tests/term/getTerms.php b/tests/phpunit/tests/term/getTerms.php index e996cffdbd5d..48d80138ff53 100644 --- a/tests/phpunit/tests/term/getTerms.php +++ b/tests/phpunit/tests/term/getTerms.php @@ -861,7 +861,7 @@ function test_get_term_children_recursion() { $term = get_term( $term['term_id'], 'category' ); $this->assertEquals( $term->term_id, $term->parent ); - $this->assertInternalType( 'array', get_term_children( $term->term_id, 'category' ) ); + $this->assertIsArray( get_term_children( $term->term_id, 'category' ) ); add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 ); } diff --git a/tests/phpunit/tests/term/getTheTerms.php b/tests/phpunit/tests/term/getTheTerms.php index 54450a7c8125..86cc2fb8c133 100644 --- a/tests/phpunit/tests/term/getTheTerms.php +++ b/tests/phpunit/tests/term/getTheTerms.php @@ -39,7 +39,7 @@ function test_object_term_cache() { // get_the_terms() does prime the cache. $terms = get_the_terms( $post_id, $this->taxonomy ); $cache = wp_cache_get( $post_id, $this->taxonomy . '_relationships' ); - $this->assertInternalType( 'array', $cache ); + $this->assertIsArray( $cache ); // Cache should be empty after a set. $tt_2 = wp_set_object_terms( $post_id, $terms_2, $this->taxonomy ); diff --git a/tests/phpunit/tests/term/termExists.php b/tests/phpunit/tests/term/termExists.php index 27aa2791df64..d963e793ba94 100644 --- a/tests/phpunit/tests/term/termExists.php +++ b/tests/phpunit/tests/term/termExists.php @@ -116,7 +116,7 @@ public function test_term_exists_taxonomy_nonempty_parent_nonempty_match_slug() _unregister_taxonomy( 'foo' ); - $this->assertInternalType( 'array', $found ); + $this->assertIsArray( $found ); $this->assertEquals( $t, $found['term_id'] ); } @@ -180,7 +180,7 @@ public function test_term_exists_taxonomy_nonempty_parent_nonempty_match_name() _unregister_taxonomy( 'foo' ); - $this->assertInternalType( 'array', $found ); + $this->assertIsArray( $found ); $this->assertEquals( $t, $found['term_id'] ); } @@ -198,7 +198,7 @@ public function test_term_exists_taxonomy_nonempty_parent_empty_match_slug() { _unregister_taxonomy( 'foo' ); - $this->assertInternalType( 'array', $found ); + $this->assertIsArray( $found ); $this->assertEquals( $t, $found['term_id'] ); } @@ -216,7 +216,7 @@ public function test_term_exists_taxonomy_nonempty_parent_empty_match_name() { _unregister_taxonomy( 'foo' ); - $this->assertInternalType( 'array', $found ); + $this->assertIsArray( $found ); $this->assertEquals( $t, $found['term_id'] ); } @@ -262,7 +262,7 @@ function test_term_exists_known() { // Insert a term. $term = rand_str(); $t = wp_insert_term( $term, 'wptests_tax' ); - $this->assertInternalType( 'array', $t ); + $this->assertIsArray( $t ); $this->assertEquals( $t['term_id'], term_exists( $t['term_id'] ) ); $this->assertEquals( $t['term_id'], term_exists( $term ) ); diff --git a/tests/phpunit/tests/term/wpGenerateTagCloud.php b/tests/phpunit/tests/term/wpGenerateTagCloud.php index 72584dcef1ee..50597f67d9a1 100644 --- a/tests/phpunit/tests/term/wpGenerateTagCloud.php +++ b/tests/phpunit/tests/term/wpGenerateTagCloud.php @@ -106,7 +106,7 @@ function test_hide_empty_false_format_array() { ) ); - $this->assertInternalType( 'array', $found ); + $this->assertIsArray( $found ); $this->assertStringContainsString( '>' . $tags[0]->name . '<', $found[0] ); } diff --git a/tests/phpunit/tests/term/wpInsertTerm.php b/tests/phpunit/tests/term/wpInsertTerm.php index 7a491f585436..401225f444d2 100644 --- a/tests/phpunit/tests/term/wpInsertTerm.php +++ b/tests/phpunit/tests/term/wpInsertTerm.php @@ -27,7 +27,7 @@ public function test_wp_insert_delete_term() { $initial_count = wp_count_terms( $taxonomy ); $t = wp_insert_term( $term, $taxonomy ); - $this->assertInternalType( 'array', $t ); + $this->assertIsArray( $t ); $this->assertNotWPError( $t ); $this->assertTrue( $t['term_id'] > 0 ); $this->assertTrue( $t['term_taxonomy_id'] > 0 ); @@ -776,7 +776,7 @@ public function test_wp_insert_term_should_return_term_id_and_term_taxonomy_id() _unregister_taxonomy( 'wptests_tax' ); - $this->assertInternalType( 'array', $found ); + $this->assertIsArray( $found ); $this->assertNotEmpty( $found['term_id'] ); $this->assertNotEmpty( $found['term_taxonomy_id'] ); $this->assertNotEmpty( $term_by_id ); @@ -902,7 +902,7 @@ 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->assertInternalType( 'array', $object_ids ); + $this->assertIsArray( $object_ids ); // Pesky string $this->assertInternalType( 'int', $tt_id ); $this->assertEquals( $term, $deleted_term->term_id ); $this->assertEquals( $taxonomy, $deleted_term->taxonomy ); diff --git a/tests/phpunit/tests/term/wpSetObjectTerms.php b/tests/phpunit/tests/term/wpSetObjectTerms.php index c3d146b34d31..c510ed9a801a 100644 --- a/tests/phpunit/tests/term/wpSetObjectTerms.php +++ b/tests/phpunit/tests/term/wpSetObjectTerms.php @@ -106,7 +106,7 @@ function test_set_object_terms_by_id() { for ( $i = 0; $i < 3; $i++ ) { $term = "term_{$i}"; $result = wp_insert_term( $term, $this->taxonomy ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $term_id[ $term ] = $result['term_id']; } @@ -254,7 +254,7 @@ function test_change_object_terms_by_id() { for ( $i = 0; $i < 3; $i++ ) { $term = "term_{$i}"; $result = wp_insert_term( $term, $this->taxonomy ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $terms_1[ $i ] = $result['term_id']; } diff --git a/tests/phpunit/tests/term/wpUpdateTerm.php b/tests/phpunit/tests/term/wpUpdateTerm.php index 5de6d83c599a..0797d4ab0676 100644 --- a/tests/phpunit/tests/term/wpUpdateTerm.php +++ b/tests/phpunit/tests/term/wpUpdateTerm.php @@ -612,7 +612,7 @@ public function test_wp_update_term_should_return_term_id_and_term_taxonomy_id() _unregister_taxonomy( 'wptests_tax' ); - $this->assertInternalType( 'array', $found ); + $this->assertIsArray( $found ); $this->assertNotEmpty( $found['term_id'] ); $this->assertNotEmpty( $found['term_taxonomy_id'] ); $this->assertNotEmpty( $term_by_id ); diff --git a/tests/phpunit/tests/theme/getThemeStarterContent.php b/tests/phpunit/tests/theme/getThemeStarterContent.php index b4ff34cdafc1..9a21027d6c99 100644 --- a/tests/phpunit/tests/theme/getThemeStarterContent.php +++ b/tests/phpunit/tests/theme/getThemeStarterContent.php @@ -142,17 +142,17 @@ function test_default_content_sections() { $this->assertSame( $dehydrated_starter_content['attachments']['featured-image-logo'], $hydrated_starter_content['attachments']['featured-image-logo'] ); foreach ( $hydrated_starter_content['widgets']['sidebar-1'] as $widget ) { - $this->assertInternalType( 'array', $widget ); + $this->assertIsArray( $widget ); $this->assertCount( 2, $widget ); $this->assertInternalType( 'string', $widget[0] ); - $this->assertInternalType( 'array', $widget[1] ); + $this->assertIsArray( $widget[1] ); $this->assertArrayHasKey( 'title', $widget[1] ); } $this->assertEquals( 'text', $hydrated_starter_content['widgets']['sidebar-1'][1][0], 'Core content extended' ); $this->assertEquals( 'Our Story', $hydrated_starter_content['widgets']['sidebar-1'][1][1]['title'], 'Core content extended' ); foreach ( $hydrated_starter_content['nav_menus']['top']['items'] as $nav_menu_item ) { - $this->assertInternalType( 'array', $nav_menu_item ); + $this->assertIsArray( $nav_menu_item ); $this->assertTrue( ! empty( $nav_menu_item['object_id'] ) || ! empty( $nav_menu_item['url'] ) ); } $this->assertEquals( 'Email Us', $hydrated_starter_content['nav_menus']['top']['items'][4]['title'], 'Core content extended' ); @@ -160,7 +160,7 @@ function test_default_content_sections() { foreach ( $hydrated_starter_content['posts'] as $key => $post ) { $this->assertInternalType( 'string', $key ); $this->assertFalse( is_numeric( $key ) ); - $this->assertInternalType( 'array', $post ); + $this->assertIsArray( $post ); $this->assertArrayHasKey( 'post_type', $post ); $this->assertArrayHasKey( 'post_title', $post ); } @@ -200,7 +200,7 @@ function test_get_theme_starter_content_filter() { * @return array Filtered starter content. */ public function filter_theme_starter_content( $content, $config ) { - $this->assertInternalType( 'array', $config ); + $this->assertIsArray( $config ); $this->assertCount( 1, $config['widgets']['sidebar-1'] ); $content['widgets']['sidebar-1'][] = array( 'text', diff --git a/tests/phpunit/tests/widgets.php b/tests/phpunit/tests/widgets.php index a7e16df59a3f..273ee6180293 100644 --- a/tests/phpunit/tests/widgets.php +++ b/tests/phpunit/tests/widgets.php @@ -538,7 +538,7 @@ function test_wp_widget_get_settings() { $this->assertEquals( 1, $option_value['_multiwidget'] ); $this->assertArrayHasKey( 2, $option_value ); $instance = $option_value[2]; - $this->assertInternalType( 'array', $instance ); + $this->assertIsArray( $instance ); $this->assertArrayHasKey( 'title', $instance ); unset( $option_value['_multiwidget'] ); @@ -772,11 +772,11 @@ function test_retrieve_widgets_with_theme_mod() { $result = retrieve_widgets( true ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( $result, $sidebars_widgets ); foreach ( $sidebars_widgets as $widgets ) { - $this->assertInternalType( 'array', $widgets ); + $this->assertIsArray( $widgets ); } $this->assertContains( 'tag_cloud-1', $sidebars_widgets['sidebar-1'] ); @@ -822,11 +822,11 @@ function test_retrieve_widgets_with_sidebars_widgets_matching_registered_sidebar $result = retrieve_widgets( true ); // $sidebars_widgets matches registered sidebars. - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( $result, $sidebars_widgets ); foreach ( $sidebars_widgets as $widgets ) { - $this->assertInternalType( 'array', $widgets ); + $this->assertIsArray( $widgets ); } $this->assertContains( 'tag_cloud-1', $sidebars_widgets['sidebar-1'] ); @@ -861,11 +861,11 @@ function test_retrieve_widgets_with_sidebars_widgets_not_matching_registered_sid $result = retrieve_widgets( true ); $_wp_sidebars_widgets = array(); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( $result, $sidebars_widgets ); foreach ( $sidebars_widgets as $widgets ) { - $this->assertInternalType( 'array', $widgets ); + $this->assertIsArray( $widgets ); } // Current theme doesn't have a fantasy-sidebar. @@ -904,11 +904,11 @@ function test_retrieve_widgets_with_sidebars_widgets_not_matching_registered_sid $result = retrieve_widgets(); $_wp_sidebars_widgets = array(); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( $result, $sidebars_widgets ); foreach ( $sidebars_widgets as $widgets ) { - $this->assertInternalType( 'array', $widgets ); + $this->assertIsArray( $widgets ); } // This sidebar is not registered anymore. @@ -956,11 +956,11 @@ function test_retrieve_widgets_for_customizer() { $result = retrieve_widgets( 'customize' ); $_wp_sidebars_widgets = array(); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( $result, $sidebars_widgets ); foreach ( $sidebars_widgets as $widgets ) { - $this->assertInternalType( 'array', $widgets ); + $this->assertIsArray( $widgets ); } $this->assertContains( 'tag_cloud-1', $sidebars_widgets['sidebar-1'] ); @@ -1025,10 +1025,10 @@ function test_retrieve_widgets_move_orphaned_widgets_to_inactive() { retrieve_widgets(); - $this->assertInternalType( 'array', $sidebars_widgets ); + $this->assertIsArray( $sidebars_widgets ); foreach ( $sidebars_widgets as $widgets ) { - $this->assertInternalType( 'array', $widgets ); + $this->assertIsArray( $widgets ); } // 6 default widgets + 1 orphaned calendar widget = 7. @@ -1058,7 +1058,7 @@ public function test__wp_remove_unregistered_widgets() { $filtered_widgets = _wp_remove_unregistered_widgets( $widgets, $allowed_widgets ); - $this->assertInternalType( 'array', $filtered_widgets ); + $this->assertIsArray( $filtered_widgets ); $this->assertArrayHasKey( 'fantasy', $filtered_widgets ); $this->assertEmpty( $filtered_widgets['fantasy'] ); $this->assertArrayHasKey( 'array_version', $filtered_widgets ); diff --git a/tests/phpunit/tests/widgets/media-widget.php b/tests/phpunit/tests/widgets/media-widget.php index 68cc2e19c032..aa7ef6f3fb79 100644 --- a/tests/phpunit/tests/widgets/media-widget.php +++ b/tests/phpunit/tests/widgets/media-widget.php @@ -219,7 +219,7 @@ function test_get_instance_schema() { $this->filter_instance_schema_args = null; add_filter( 'widget_mocked_instance_schema', array( $this, 'filter_instance_schema' ), 10, 2 ); $schema = $widget->get_instance_schema(); - $this->assertInternalType( 'array', $this->filter_instance_schema_args ); + $this->assertIsArray( $this->filter_instance_schema_args ); $this->assertSame( $widget, $this->filter_instance_schema_args['widget'] ); $this->assertEqualSets( array( 'attachment_id', 'title', 'url' ), array_keys( $this->filter_instance_schema_args['schema'] ) ); $this->assertArrayHasKey( 'injected', $schema ); diff --git a/tests/phpunit/tests/xmlrpc/mw/getPost.php b/tests/phpunit/tests/xmlrpc/mw/getPost.php index 9c914d708eeb..2c9c66039b71 100644 --- a/tests/phpunit/tests/xmlrpc/mw/getPost.php +++ b/tests/phpunit/tests/xmlrpc/mw/getPost.php @@ -58,7 +58,7 @@ function test_valid_post() { $this->assertInternalType( 'string', $result['title'] ); $this->assertInternalType( 'string', $result['link'] ); $this->assertInternalType( 'string', $result['permaLink'] ); - $this->assertInternalType( 'array', $result['categories'] ); + $this->assertIsArray( $result['categories'] ); $this->assertInternalType( 'string', $result['mt_excerpt'] ); $this->assertInternalType( 'string', $result['mt_text_more'] ); $this->assertInternalType( 'string', $result['wp_more_text'] ); @@ -70,7 +70,7 @@ function test_valid_post() { $this->assertInternalType( 'string', $result['wp_author_id'] ); $this->assertInternalType( 'string', $result['wp_author_display_name'] ); $this->assertInternalType( 'string', $result['post_status'] ); - $this->assertInternalType( 'array', $result['custom_fields'] ); + $this->assertIsArray( $result['custom_fields'] ); $this->assertInternalType( 'string', $result['wp_post_format'] ); $this->assertInternalType( 'bool', $result['sticky'] ); diff --git a/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php b/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php index 06350d00e1af..c20e81f7248f 100644 --- a/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php +++ b/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php @@ -64,7 +64,7 @@ function test_valid_post() { $this->assertInternalType( 'string', $result['title'] ); $this->assertInternalType( 'string', $result['link'] ); $this->assertInternalType( 'string', $result['permaLink'] ); - $this->assertInternalType( 'array', $result['categories'] ); + $this->assertIsArray( $result['categories'] ); $this->assertInternalType( 'string', $result['mt_excerpt'] ); $this->assertInternalType( 'string', $result['mt_text_more'] ); $this->assertInternalType( 'string', $result['wp_more_text'] ); @@ -76,7 +76,7 @@ function test_valid_post() { $this->assertInternalType( 'string', $result['wp_author_id'] ); $this->assertInternalType( 'string', $result['wp_author_display_name'] ); $this->assertInternalType( 'string', $result['post_status'] ); - $this->assertInternalType( 'array', $result['custom_fields'] ); + $this->assertIsArray( $result['custom_fields'] ); $this->assertInternalType( 'string', $result['wp_post_format'] ); // Check expected values. diff --git a/tests/phpunit/tests/xmlrpc/wp/editPost.php b/tests/phpunit/tests/xmlrpc/wp/editPost.php index 45ce7d6edf12..032d283cfdea 100644 --- a/tests/phpunit/tests/xmlrpc/wp/editPost.php +++ b/tests/phpunit/tests/xmlrpc/wp/editPost.php @@ -159,7 +159,7 @@ function test_post_thumbnail() { $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $post_id ) ); $this->assertNotIXRError( $result ); $this->assertArrayHasKey( 'post_thumbnail', $result ); - $this->assertInternalType( 'array', $result['post_thumbnail'] ); + $this->assertIsArray( $result['post_thumbnail'] ); $this->assertEquals( $attachment_id, $result['post_thumbnail']['attachment_id'] ); // Edit the post without supplying a post_thumbnail and check that it didn't change. diff --git a/tests/phpunit/tests/xmlrpc/wp/getComments.php b/tests/phpunit/tests/xmlrpc/wp/getComments.php index b3b1d03e3a44..1f861a7045ea 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getComments.php +++ b/tests/phpunit/tests/xmlrpc/wp/getComments.php @@ -198,7 +198,7 @@ function test_author_capabilities() { ) ); - $this->assertInternalType( 'array', $result2 ); + $this->assertIsArray( $result2 ); $this->assertCount( 1, $result2 ); $result3 = $this->myxmlrpcserver->wp_getComments( @@ -225,7 +225,7 @@ function test_author_capabilities() { ) ); - $this->assertInternalType( 'array', $result4 ); + $this->assertIsArray( $result4 ); $this->assertCount( 1, $result4 ); } @@ -276,7 +276,7 @@ function test_editor_capabilities() { ), ) ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertCount( 1, $result ); $result2 = $this->myxmlrpcserver->wp_getComments( @@ -291,7 +291,7 @@ function test_editor_capabilities() { ) ); - $this->assertInternalType( 'array', $result2 ); + $this->assertIsArray( $result2 ); $this->assertCount( 1, $result2 ); } } diff --git a/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php b/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php index 41f0eded1fde..746761bb9ac6 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php +++ b/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php @@ -58,7 +58,7 @@ function test_valid_media_item() { $this->assertInternalType( 'string', $result['description'] ); $this->assertInternalType( 'string', $result['link'] ); $this->assertInternalType( 'string', $result['thumbnail'] ); - $this->assertInternalType( 'array', $result['metadata'] ); + $this->assertIsArray( $result['metadata'] ); // Check expected values. $this->assertStringMatchesFormat( '%d', $result['attachment_id'] ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getOptions.php b/tests/phpunit/tests/xmlrpc/wp/getOptions.php index 59b3636b3c4e..fc3db750b8a4 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getOptions.php +++ b/tests/phpunit/tests/xmlrpc/wp/getOptions.php @@ -15,7 +15,7 @@ function test_valid_username_password() { $this->make_user_by_role( 'subscriber' ); $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'subscriber', 'subscriber' ) ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( 'WordPress', $result['software_name']['value'] ); } @@ -23,7 +23,7 @@ function test_option_value() { $this->make_user_by_role( 'administrator' ); $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'administrator', 'administrator', 'default_comment_status' ) ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] ); $this->assertFalse( $result['default_comment_status']['readonly'] ); @@ -37,7 +37,7 @@ function test_option_values_subscriber() { $this->make_user_by_role( 'subscriber' ); $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'subscriber', 'subscriber' ) ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); // Read-only options. $this->assertEquals( 'WordPress', $result['software_name']['value'] ); @@ -126,7 +126,7 @@ function test_option_values_admin() { $this->make_user_by_role( 'administrator' ); $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'administrator', 'administrator' ) ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); // Read-only options. $this->assertEquals( 'WordPress', $result['software_name']['value'] ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getPage.php b/tests/phpunit/tests/xmlrpc/wp/getPage.php index 7991f5568d6f..061e6a2f1221 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getPage.php +++ b/tests/phpunit/tests/xmlrpc/wp/getPage.php @@ -53,7 +53,7 @@ function test_valid_page() { $this->assertInternalType( 'string', $result['title'] ); $this->assertInternalType( 'string', $result['link'] ); $this->assertInternalType( 'string', $result['permaLink'] ); - $this->assertInternalType( 'array', $result['categories'] ); + $this->assertIsArray( $result['categories'] ); $this->assertInternalType( 'string', $result['excerpt'] ); $this->assertInternalType( 'string', $result['text_more'] ); $this->assertInternalType( 'int', $result['mt_allow_comments'] ); @@ -66,7 +66,7 @@ function test_valid_page() { $this->assertInternalType( 'int', $result['wp_page_order'] ); $this->assertInternalType( 'string', $result['wp_author_id'] ); $this->assertInternalType( 'string', $result['wp_author_display_name'] ); - $this->assertInternalType( 'array', $result['custom_fields'] ); + $this->assertIsArray( $result['custom_fields'] ); $this->assertInternalType( 'string', $result['wp_page_template'] ); $post_data = get_post( self::$post_id ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getPost.php b/tests/phpunit/tests/xmlrpc/wp/getPost.php index 1d0e01afcc82..06fa1e47418f 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getPost.php +++ b/tests/phpunit/tests/xmlrpc/wp/getPost.php @@ -60,8 +60,8 @@ function test_valid_post() { $this->assertInternalType( 'string', $result['ping_status'] ); $this->assertInternalType( 'bool', $result['sticky'] ); $this->assertInternalType( 'string', $result['post_format'] ); - $this->assertInternalType( 'array', $result['post_thumbnail'] ); - $this->assertInternalType( 'array', $result['custom_fields'] ); + $this->assertIsArray( $result['post_thumbnail'] ); + $this->assertIsArray( $result['custom_fields'] ); // Check expected values. $this->assertStringMatchesFormat( '%d', $result['post_id'] ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getPostType.php b/tests/phpunit/tests/xmlrpc/wp/getPostType.php index d62f426d1453..5c126e67a34e 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getPostType.php +++ b/tests/phpunit/tests/xmlrpc/wp/getPostType.php @@ -75,10 +75,10 @@ function test_valid_type() { $this->assertInternalType( 'bool', $result['show_ui'] ); $this->assertInternalType( 'int', $result['menu_position'] ); $this->assertInternalType( 'string', $result['menu_icon'] ); - $this->assertInternalType( 'array', $result['labels'] ); - $this->assertInternalType( 'array', $result['cap'] ); - $this->assertInternalType( 'array', $result['taxonomies'] ); - $this->assertInternalType( 'array', $result['supports'] ); + $this->assertIsArray( $result['labels'] ); + $this->assertIsArray( $result['cap'] ); + $this->assertIsArray( $result['taxonomies'] ); + $this->assertIsArray( $result['supports'] ); // Check label data types. $this->assertInternalType( 'string', $result['labels']['name'] ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getPostTypes.php b/tests/phpunit/tests/xmlrpc/wp/getPostTypes.php index 20f1092574a4..ae80d4e8e82b 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getPostTypes.php +++ b/tests/phpunit/tests/xmlrpc/wp/getPostTypes.php @@ -15,7 +15,7 @@ function test_incapable_user() { $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'subscriber', 'subscriber' ) ); $this->assertNotIXRError( $result ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( 0, count( $result ) ); } @@ -24,7 +24,7 @@ function test_capable_user() { $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor' ) ); $this->assertNotIXRError( $result ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertGreaterThan( 0, count( $result ) ); } @@ -33,7 +33,7 @@ function test_simple_filter() { $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor', array( 'hierarchical' => true ) ) ); $this->assertNotIXRError( $result ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); // Verify that page is in the result, and post is not. $result_names = wp_list_pluck( $result, 'name' ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getRevisions.php b/tests/phpunit/tests/xmlrpc/wp/getRevisions.php index 15b9287d757f..52b8572449a9 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getRevisions.php +++ b/tests/phpunit/tests/xmlrpc/wp/getRevisions.php @@ -41,7 +41,7 @@ function test_revision_count() { ); // Create the initial revision. $result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'editor', 'editor', $post_id ) ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertCount( 1, $result ); wp_insert_post( @@ -52,7 +52,7 @@ function test_revision_count() { ); $result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'editor', 'editor', $post_id ) ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertCount( 2, $result ); } diff --git a/tests/phpunit/tests/xmlrpc/wp/getTerm.php b/tests/phpunit/tests/xmlrpc/wp/getTerm.php index 35910f6f5d3b..190725c3b872 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getTerm.php +++ b/tests/phpunit/tests/xmlrpc/wp/getTerm.php @@ -121,7 +121,7 @@ public function test_get_term_meta() { ); $this->assertNotIXRError( $result ); - $this->assertInternalType( 'array', $result['custom_fields'] ); + $this->assertIsArray( $result['custom_fields'] ); $term_meta = get_term_meta( self::$term_id, '', true ); $this->assertEquals( $term_meta['foo'][0], $result['custom_fields'][0]['value'] ); } diff --git a/tests/phpunit/tests/xmlrpc/wp/getTerms.php b/tests/phpunit/tests/xmlrpc/wp/getTerms.php index 0dca65e409c0..751b6c0c8756 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getTerms.php +++ b/tests/phpunit/tests/xmlrpc/wp/getTerms.php @@ -51,7 +51,7 @@ function test_valid_terms() { $this->assertInternalType( 'int', $term['count'] ); // Check custom term meta. - $this->assertInternalType( 'array', $term['custom_fields'] ); + $this->assertIsArray( $term['custom_fields'] ); // We expect all other IDs to be strings, not integers, // so we don't return something larger than an XMLRPC integer can describe. diff --git a/tests/phpunit/tests/xmlrpc/wp/getUser.php b/tests/phpunit/tests/xmlrpc/wp/getUser.php index d46424b644ca..bbb94e32f612 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getUser.php +++ b/tests/phpunit/tests/xmlrpc/wp/getUser.php @@ -88,7 +88,7 @@ function test_valid_user() { $this->assertInternalType( 'string', $result['nicename'] ); $this->assertInternalType( 'string', $result['url'] ); $this->assertInternalType( 'string', $result['display_name'] ); - $this->assertInternalType( 'array', $result['roles'] ); + $this->assertIsArray( $result['roles'] ); // Check expected values. $this->assertEquals( $user_id, $result['user_id'] ); diff --git a/tests/phpunit/tests/xmlrpc/wp/getUsers.php b/tests/phpunit/tests/xmlrpc/wp/getUsers.php index 412a13b36418..34ab25f3550d 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getUsers.php +++ b/tests/phpunit/tests/xmlrpc/wp/getUsers.php @@ -39,7 +39,7 @@ function test_capable_user() { $this->assertInternalType( 'string', $result[0]['nicename'] ); $this->assertInternalType( 'string', $result[0]['url'] ); $this->assertInternalType( 'string', $result[0]['display_name'] ); - $this->assertInternalType( 'array', $result[0]['roles'] ); + $this->assertIsArray( $result[0]['roles'] ); } function test_invalid_role() { diff --git a/tests/phpunit/tests/xmlrpc/wp/newPost.php b/tests/phpunit/tests/xmlrpc/wp/newPost.php index 675a47577e11..c0f546e89a48 100644 --- a/tests/phpunit/tests/xmlrpc/wp/newPost.php +++ b/tests/phpunit/tests/xmlrpc/wp/newPost.php @@ -280,11 +280,11 @@ function test_terms() { $this->make_user_by_role( 'editor' ); $tag1 = wp_create_tag( 'tag1' ); - $this->assertInternalType( 'array', $tag1 ); + $this->assertIsArray( $tag1 ); $tag2 = wp_create_tag( 'tag2' ); - $this->assertInternalType( 'array', $tag2 ); + $this->assertIsArray( $tag2 ); $tag3 = wp_create_tag( 'tag3' ); - $this->assertInternalType( 'array', $tag3 ); + $this->assertIsArray( $tag3 ); $post = array( 'post_title' => 'Test', diff --git a/tests/phpunit/tests/xmlrpc/wp/setOptions.php b/tests/phpunit/tests/xmlrpc/wp/setOptions.php index 27ad135ddc7c..2843461fbfc1 100644 --- a/tests/phpunit/tests/xmlrpc/wp/setOptions.php +++ b/tests/phpunit/tests/xmlrpc/wp/setOptions.php @@ -26,7 +26,7 @@ function test_set_option_no_escape_strings() { ) ); - $this->assertInternalType( 'array', $result ); + $this->assertIsArray( $result ); $this->assertEquals( $escaped_string_with_quote, $result['blog_title']['value'] ); $this->assertEquals( 'open', $result['default_comment_status']['value'] ); }