Changeset 48937 for trunk/tests/phpunit/tests/customize/manager.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/manager.php
r48858 r48937 120 120 ) 121 121 ); 122 $this->assert Equals( $uuid, $wp_customize->changeset_uuid() );123 $this->assert Equals( $theme, $wp_customize->get_stylesheet() );124 $this->assert Equals( $messenger_channel, $wp_customize->get_messenger_channel() );122 $this->assertSame( $uuid, $wp_customize->changeset_uuid() ); 123 $this->assertSame( $theme, $wp_customize->get_stylesheet() ); 124 $this->assertSame( $messenger_channel, $wp_customize->get_messenger_channel() ); 125 125 $this->assertFalse( $wp_customize->autosaved() ); 126 126 $this->assertTrue( $wp_customize->branching() ); … … 138 138 $_REQUEST['customize_messenger_channel'] = $messenger_channel; 139 139 $wp_customize = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) ); 140 $this->assert Equals( $theme, $wp_customize->get_stylesheet() );141 $this->assert Equals( $messenger_channel, $wp_customize->get_messenger_channel() );140 $this->assertSame( $theme, $wp_customize->get_stylesheet() ); 141 $this->assertSame( $messenger_channel, $wp_customize->get_messenger_channel() ); 142 142 143 143 $theme = 'twentyfourteen'; 144 144 $_REQUEST['customize_theme'] = $theme; 145 145 $wp_customize = new WP_Customize_Manager(); 146 $this->assert Equals( $theme, $wp_customize->get_stylesheet() );146 $this->assertSame( $theme, $wp_customize->get_stylesheet() ); 147 147 $this->assertTrue( wp_is_uuid( $wp_customize->changeset_uuid(), 4 ) ); 148 148 } … … 199 199 ) 200 200 ); 201 $this->assert Equals( $uuid2, $wp_customize->changeset_uuid() );202 $this->assert Equals( $post_id, $wp_customize->changeset_post_id() );201 $this->assertSame( $uuid2, $wp_customize->changeset_uuid() ); 202 $this->assertSame( $post_id, $wp_customize->changeset_post_id() ); 203 203 204 204 $wp_customize = new WP_Customize_Manager( … … 265 265 update_option( 'fresh_site', '1' ); 266 266 $wp_customize->setup_theme(); 267 $this->assert Equals( 100, has_action( 'after_setup_theme', array( $wp_customize, 'import_theme_starter_content' ) ) );267 $this->assertSame( 100, has_action( 'after_setup_theme', array( $wp_customize, 'import_theme_starter_content' ) ) ); 268 268 } 269 269 … … 280 280 update_option( 'fresh_site', '1' ); 281 281 do_action( 'customize_save_after', $wp_customize ); 282 $this->assert Equals( '0', get_option( 'fresh_site' ) );282 $this->assertSame( '0', get_option( 'fresh_site' ) ); 283 283 284 284 // Simulate a new, uncached request. … … 334 334 function test_settings_previewed() { 335 335 $wp_customize = new WP_Customize_Manager( array( 'settings_previewed' => false ) ); 336 $this->assert Same( false,$wp_customize->settings_previewed() );336 $this->assertFalse( $wp_customize->settings_previewed() ); 337 337 338 338 $wp_customize = new WP_Customize_Manager(); 339 $this->assert Same( true,$wp_customize->settings_previewed() );339 $this->assertTrue( $wp_customize->settings_previewed() ); 340 340 } 341 341 … … 388 388 $uuid = wp_generate_uuid4(); 389 389 $wp_customize = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) ); 390 $this->assert Equals( $uuid, $wp_customize->changeset_uuid() );390 $this->assertSame( $uuid, $wp_customize->changeset_uuid() ); 391 391 } 392 392 … … 407 407 $wp_customize->wp_loaded(); 408 408 $this->assertFalse( $wp_customize->is_preview() ); 409 $this->assert Equals( $title, $wp_customize->get_setting( 'blogname' )->value() );410 $this->assert Equals( $title, get_option( 'blogname' ) );409 $this->assertSame( $title, $wp_customize->get_setting( 'blogname' )->value() ); 410 $this->assertSame( $title, get_option( 'blogname' ) ); 411 411 } 412 412 … … 430 430 $wp_customize = new WP_Customize_Manager(); 431 431 $this->assertNull( $wp_customize->find_changeset_post_id( wp_generate_uuid4() ) ); 432 $this->assert Equals( $post_id, $wp_customize->find_changeset_post_id( $uuid ) );432 $this->assertSame( $post_id, $wp_customize->find_changeset_post_id( $uuid ) ); 433 433 434 434 // Verify that the found post ID was cached under the given UUID, not the manager's UUID. … … 457 457 ) 458 458 ); 459 $this->assert Equals( $post_id, $wp_customize->changeset_post_id() );459 $this->assertSame( $post_id, $wp_customize->changeset_post_id() ); 460 460 } 461 461 … … 470 470 $uuid = wp_generate_uuid4(); 471 471 $wp_customize = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) ); 472 $this->assert Equals( array(), $wp_customize->changeset_data() );472 $this->assertSame( array(), $wp_customize->changeset_data() ); 473 473 474 474 $uuid = wp_generate_uuid4(); … … 486 486 ); 487 487 $wp_customize = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) ); 488 $this->assert Equals( $data, $wp_customize->changeset_data() );488 $this->assertSame( $data, $wp_customize->changeset_data() ); 489 489 490 490 // Autosave. … … 507 507 $wp_customize->register_controls(); // That is, settings. 508 508 $this->assertFalse( $wp_customize->autosaved() ); 509 $this->assert Equals( $data, $wp_customize->changeset_data() );509 $this->assertSame( $data, $wp_customize->changeset_data() ); 510 510 511 511 // No change to data if not requesting autosave. … … 518 518 $this->assertTrue( $wp_customize->autosaved() ); 519 519 $this->assertNotEquals( $data, $wp_customize->changeset_data() ); 520 $this->assert Equals(520 $this->assertSame( 521 521 array_merge( 522 522 wp_list_pluck( $data, 'value' ), … … 534 534 ) 535 535 ); 536 $this->assert Equals( $data, $wp_customize->changeset_data() );536 $this->assertSame( $data, $wp_customize->changeset_data() ); 537 537 } 538 538 … … 684 684 } 685 685 686 $this->assert Equals( array( 'text-2', 'meta-3' ), $changeset_values['sidebars_widgets[sidebar-1]'] );686 $this->assertSame( array( 'text-2', 'meta-3' ), $changeset_values['sidebars_widgets[sidebar-1]'] ); 687 687 688 688 $posts_by_name = array(); … … 694 694 $post = get_post( $post_id ); 695 695 if ( $post->ID === $existing_published_home_page_id ) { 696 $this->assert Equals( 'publish', $post->post_status );696 $this->assertSame( 'publish', $post->post_status ); 697 697 } elseif ( $post->ID === $existing_canola_attachment_id ) { 698 $this->assert Equals( 'inherit', $post->post_status );698 $this->assertSame( 'inherit', $post->post_status ); 699 699 } else { 700 $this->assert Equals( 'auto-draft', $post->post_status );700 $this->assertSame( 'auto-draft', $post->post_status ); 701 701 $this->assertEmpty( $post->post_name ); 702 702 } … … 707 707 $posts_by_name[ $post_name ] = $post->ID; 708 708 } 709 $this->assert Equals( array( 'waffles', 'canola', 'home', 'about', 'blog', 'custom', 'unknown-cpt' ), array_keys( $posts_by_name ) );710 $this->assert Equals( 'Custom', get_post( $posts_by_name['custom'] )->post_title );711 $this->assert Equals( 'sample-page-template.php', get_page_template_slug( $posts_by_name['about'] ) );712 $this->assert Equals( '', get_page_template_slug( $posts_by_name['blog'] ) );713 $this->assert Equals( $posts_by_name['waffles'], get_post_thumbnail_id( $posts_by_name['custom'] ) );714 $this->assert Equals( 0, get_post_thumbnail_id( $posts_by_name['blog'] ) );709 $this->assertSame( array( 'waffles', 'canola', 'home', 'about', 'blog', 'custom', 'unknown-cpt' ), array_keys( $posts_by_name ) ); 710 $this->assertSame( 'Custom', get_post( $posts_by_name['custom'] )->post_title ); 711 $this->assertSame( 'sample-page-template.php', get_page_template_slug( $posts_by_name['about'] ) ); 712 $this->assertSame( '', get_page_template_slug( $posts_by_name['blog'] ) ); 713 $this->assertSame( $posts_by_name['waffles'], get_post_thumbnail_id( $posts_by_name['custom'] ) ); 714 $this->assertSame( 0, get_post_thumbnail_id( $posts_by_name['blog'] ) ); 715 715 $attachment_metadata = wp_get_attachment_metadata( $posts_by_name['waffles'] ); 716 $this->assert Equals( 'Waffles', get_post( $posts_by_name['waffles'] )->post_title );717 $this->assert Equals( 'waffles', get_post_meta( $posts_by_name['waffles'], '_customize_draft_post_name', true ) );716 $this->assertSame( 'Waffles', get_post( $posts_by_name['waffles'] )->post_title ); 717 $this->assertSame( 'waffles', get_post_meta( $posts_by_name['waffles'], '_customize_draft_post_name', true ) ); 718 718 $this->assertArrayHasKey( 'file', $attachment_metadata ); 719 719 $this->assertContains( 'waffles', $attachment_metadata['file'] ); 720 720 721 $this->assert Equals( 'page', $changeset_values['show_on_front'] );722 $this->assert Equals( $posts_by_name['home'], $changeset_values['page_on_front'] );723 $this->assert Equals( $posts_by_name['blog'], $changeset_values['page_for_posts'] );724 725 $this->assert Equals( -1, $changeset_values['nav_menu_locations[top]'] );726 $this->assert Equals( 0, $changeset_values['nav_menu_item[-1]']['object_id'] );727 $this->assert Equals( 'custom', $changeset_values['nav_menu_item[-1]']['type'] );728 $this->assert Equals( home_url( '/' ), $changeset_values['nav_menu_item[-1]']['url'] );721 $this->assertSame( 'page', $changeset_values['show_on_front'] ); 722 $this->assertSame( $posts_by_name['home'], $changeset_values['page_on_front'] ); 723 $this->assertSame( $posts_by_name['blog'], $changeset_values['page_for_posts'] ); 724 725 $this->assertSame( -1, $changeset_values['nav_menu_locations[top]'] ); 726 $this->assertSame( 0, $changeset_values['nav_menu_item[-1]']['object_id'] ); 727 $this->assertSame( 'custom', $changeset_values['nav_menu_item[-1]']['type'] ); 728 $this->assertSame( home_url( '/' ), $changeset_values['nav_menu_item[-1]']['url'] ); 729 729 730 730 $this->assertEmpty( $wp_customize->changeset_data() ); 731 731 $this->assertNull( $wp_customize->changeset_post_id() ); 732 $this->assert Equals( 1000, has_action( 'customize_register', array( $wp_customize, '_save_starter_content_changeset' ) ) );732 $this->assertSame( 1000, has_action( 'customize_register', array( $wp_customize, '_save_starter_content_changeset' ) ) ); 733 733 do_action( 'customize_register', $wp_customize ); // This will trigger the changeset save. 734 734 $this->assertInternalType( 'int', $wp_customize->changeset_post_id() ); … … 772 772 ); 773 773 $changeset_data = $wp_customize->changeset_data(); 774 $this->assert Equals( $previous_blogname, $changeset_data['blogname']['value'] );774 $this->assertSame( $previous_blogname, $changeset_data['blogname']['value'] ); 775 775 $this->assertArrayNotHasKey( 'starter_content', $changeset_data['blogname'] ); 776 776 $this->assertNotEquals( $previous_blogdescription, $changeset_data['blogdescription']['value'] ); … … 784 784 $this->assertEmpty( get_theme_mod( 'header_image' ) ); 785 785 $this->assertEmpty( get_theme_mod( 'background_image' ) ); 786 $this->assert Equals( 'auto-draft', get_post( $posts_by_name['about'] )->post_status );787 $this->assert Equals( 'auto-draft', get_post( $posts_by_name['waffles'] )->post_status );786 $this->assertSame( 'auto-draft', get_post( $posts_by_name['about'] )->post_status ); 787 $this->assertSame( 'auto-draft', get_post( $posts_by_name['waffles'] )->post_status ); 788 788 $this->assertNotEquals( $changeset_data['blogname']['value'], get_option( 'blogname' ) ); 789 789 $r = $wp_customize->save_changeset_post( array( 'status' => 'publish' ) ); 790 790 $this->assertInternalType( 'array', $r ); 791 $this->assert Equals( 'publish', get_post( $posts_by_name['about'] )->post_status );792 $this->assert Equals( 'inherit', get_post( $posts_by_name['waffles'] )->post_status );793 $this->assert Equals( $changeset_data['blogname']['value'], get_option( 'blogname' ) );791 $this->assertSame( 'publish', get_post( $posts_by_name['about'] )->post_status ); 792 $this->assertSame( 'inherit', get_post( $posts_by_name['waffles'] )->post_status ); 793 $this->assertSame( $changeset_data['blogname']['value'], get_option( 'blogname' ) ); 794 794 $this->assertNotEmpty( get_theme_mod( 'custom_logo' ) ); 795 795 $this->assertNotEmpty( get_theme_mod( 'header_image' ) ); … … 801 801 $this->assertContains( 'waffles', get_header_image() ); 802 802 $this->assertContains( 'waffles', get_background_image() ); 803 $this->assert Equals( 'waffles', get_post( $posts_by_name['waffles'] )->post_name );803 $this->assertSame( 'waffles', get_post( $posts_by_name['waffles'] )->post_name ); 804 804 $this->assertEmpty( get_post_meta( $posts_by_name['waffles'], '_customize_draft_post_name', true ) ); 805 805 } … … 892 892 $wp_customize = new WP_Customize_Manager(); 893 893 $wp_customize->customize_preview_init(); 894 $this->assert Equals( $did_action_customize_preview_init + 1, did_action( 'customize_preview_init' ) );895 896 $this->assert Equals( 10, has_action( 'wp_head', 'wp_no_robots' ) );897 $this->assert Equals( 10, has_action( 'wp_head', array( $wp_customize, 'remove_frameless_preview_messenger_channel' ) ) );898 $this->assert Equals( 10, has_filter( 'wp_headers', array( $wp_customize, 'filter_iframe_security_headers' ) ) );899 $this->assert Equals( 10, has_filter( 'wp_redirect', array( $wp_customize, 'add_state_query_params' ) ) );894 $this->assertSame( $did_action_customize_preview_init + 1, did_action( 'customize_preview_init' ) ); 895 896 $this->assertSame( 10, has_action( 'wp_head', 'wp_no_robots' ) ); 897 $this->assertSame( 10, has_action( 'wp_head', array( $wp_customize, 'remove_frameless_preview_messenger_channel' ) ) ); 898 $this->assertSame( 10, has_filter( 'wp_headers', array( $wp_customize, 'filter_iframe_security_headers' ) ) ); 899 $this->assertSame( 10, has_filter( 'wp_redirect', array( $wp_customize, 'add_state_query_params' ) ) ); 900 900 $this->assertTrue( wp_script_is( 'customize-preview', 'enqueued' ) ); 901 $this->assert Equals( 10, has_action( 'wp_head', array( $wp_customize, 'customize_preview_loading_style' ) ) );902 $this->assert Equals( 20, has_action( 'wp_footer', array( $wp_customize, 'customize_preview_settings' ) ) );901 $this->assertSame( 10, has_action( 'wp_head', array( $wp_customize, 'customize_preview_loading_style' ) ) ); 902 $this->assertSame( 20, has_action( 'wp_footer', array( $wp_customize, 'customize_preview_settings' ) ) ); 903 903 904 904 // Test unauthorized user outside preview (no messenger_channel). … … 935 935 $this->assertArrayHasKey( 'X-Frame-Options', $headers ); 936 936 $this->assertArrayHasKey( 'Content-Security-Policy', $headers ); 937 $this->assert Equals( 'SAMEORIGIN', $headers['X-Frame-Options'] );938 $this->assert Equals( "frame-ancestors 'self'", $headers['Content-Security-Policy'] );937 $this->assertSame( 'SAMEORIGIN', $headers['X-Frame-Options'] ); 938 $this->assertSame( "frame-ancestors 'self'", $headers['Content-Security-Policy'] ); 939 939 } 940 940 … … 962 962 $this->assertArrayHasKey( 'customize_changeset_uuid', $query_params ); 963 963 $this->assertArrayNotHasKey( 'customize_theme', $query_params ); 964 $this->assert Equals( $uuid, $query_params['customize_changeset_uuid'] );965 $this->assert Equals( $messenger_channel, $query_params['customize_messenger_channel'] );964 $this->assertSame( $uuid, $query_params['customize_changeset_uuid'] ); 965 $this->assertSame( $messenger_channel, $query_params['customize_messenger_channel'] ); 966 966 967 967 $uuid = wp_generate_uuid4(); … … 979 979 $this->assertArrayHasKey( 'customize_changeset_uuid', $query_params ); 980 980 $this->assertArrayHasKey( 'customize_theme', $query_params ); 981 $this->assert Equals( $uuid, $query_params['customize_changeset_uuid'] );982 $this->assert Equals( $preview_theme, $query_params['customize_theme'] );981 $this->assertSame( $uuid, $query_params['customize_changeset_uuid'] ); 982 $this->assertSame( $preview_theme, $query_params['customize_theme'] ); 983 983 984 984 $uuid = wp_generate_uuid4(); … … 1044 1044 $this->assertInternalType( 'array', $r ); 1045 1045 1046 $this->assert Equals( $did_action['customize_save_validation_before'] + 1, did_action( 'customize_save_validation_before' ) );1046 $this->assertSame( $did_action['customize_save_validation_before'] + 1, did_action( 'customize_save_validation_before' ) ); 1047 1047 1048 1048 $post_id = $manager->find_changeset_post_id( $uuid ); 1049 1049 $this->assertNotNull( $post_id ); 1050 1050 $saved_data = json_decode( get_post( $post_id )->post_content, true ); 1051 $this->assert Equals( $manager->unsanitized_post_values(), wp_list_pluck( $saved_data, 'value' ) );1052 $this->assert Equals( $pre_saved_data['blogname']['value'], $saved_data['blogname']['value'] );1053 $this->assert Equals( $pre_saved_data['blogdescription']['custom'], $saved_data['blogdescription']['custom'] );1051 $this->assertSame( $manager->unsanitized_post_values(), wp_list_pluck( $saved_data, 'value' ) ); 1052 $this->assertSame( $pre_saved_data['blogname']['value'], $saved_data['blogname']['value'] ); 1053 $this->assertSame( $pre_saved_data['blogdescription']['custom'], $saved_data['blogdescription']['custom'] ); 1054 1054 foreach ( $saved_data as $setting_id => $setting_params ) { 1055 1055 $this->assertArrayHasKey( 'type', $setting_params ); 1056 $this->assert Equals( 'option', $setting_params['type'] );1056 $this->assertSame( 'option', $setting_params['type'] ); 1057 1057 $this->assertArrayHasKey( 'user_id', $setting_params ); 1058 $this->assert Equals( self::$admin_user_id, $setting_params['user_id'] );1058 $this->assertSame( self::$admin_user_id, $setting_params['user_id'] ); 1059 1059 } 1060 $this->assert Equals( 'Auto Draft', get_post( $post_id )->post_title );1061 $this->assert Equals( 'auto-draft', get_post( $post_id )->post_status );1062 $this->assert Equals( $date, get_post( $post_id )->post_date_gmt );1060 $this->assertSame( 'Auto Draft', get_post( $post_id )->post_title ); 1061 $this->assertSame( 'auto-draft', get_post( $post_id )->post_status ); 1062 $this->assertSame( $date, get_post( $post_id )->post_date_gmt ); 1063 1063 $this->assertNotEquals( 'Changeset Title', get_option( 'blogname' ) ); 1064 1064 $this->assertArrayHasKey( 'setting_validities', $r ); … … 1098 1098 ); 1099 1099 $this->assertInstanceOf( 'WP_Error', $r ); 1100 $this->assert Equals( 'transaction_fail', $r->get_error_code() );1100 $this->assertSame( 'transaction_fail', $r->get_error_code() ); 1101 1101 $this->assertInternalType( 'array', $r->get_error_data() ); 1102 1102 $this->assertArrayHasKey( 'setting_validities', $r->get_error_data() ); … … 1106 1106 $this->assertArrayHasKey( 'foo_unauthorized', $error_data['setting_validities'] ); 1107 1107 $this->assertInstanceOf( 'WP_Error', $error_data['setting_validities']['foo_unauthorized'] ); 1108 $this->assert Equals( 'unauthorized', $error_data['setting_validities']['foo_unauthorized']->get_error_code() );1108 $this->assertSame( 'unauthorized', $error_data['setting_validities']['foo_unauthorized']->get_error_code() ); 1109 1109 $this->assertArrayHasKey( 'bar_unknown', $error_data['setting_validities'] ); 1110 1110 $this->assertInstanceOf( 'WP_Error', $error_data['setting_validities']['bar_unknown'] ); 1111 $this->assert Equals( 'unrecognized', $error_data['setting_validities']['bar_unknown']->get_error_code() );1111 $this->assertSame( 'unrecognized', $error_data['setting_validities']['bar_unknown']->get_error_code() ); 1112 1112 $this->assertArrayHasKey( 'baz_illegal', $error_data['setting_validities'] ); 1113 1113 $this->assertInstanceOf( 'WP_Error', $error_data['setting_validities']['baz_illegal'] ); 1114 $this->assert Equals( 'illegal', $error_data['setting_validities']['baz_illegal']->get_error_code() );1114 $this->assertSame( 'illegal', $error_data['setting_validities']['baz_illegal']->get_error_code() ); 1115 1115 1116 1116 // Since transactional, ensure no changes have been made. 1117 $this->assert Equals( $previous_saved_data, json_decode( get_post( $post_id )->post_content, true ) );1117 $this->assertSame( $previous_saved_data, json_decode( get_post( $post_id )->post_content, true ) ); 1118 1118 1119 1119 // Attempt a non-transactional/incremental update. … … 1144 1144 $saved_data = json_decode( get_post( $post_id )->post_content, true ); 1145 1145 $this->assertNotEquals( $previous_saved_data, $saved_data ); 1146 $this->assert Equals( 'Non-Transactional \o/ <script>unsanitized</script>', $saved_data['blogname']['value'] );1146 $this->assertSame( 'Non-Transactional \o/ <script>unsanitized</script>', $saved_data['blogname']['value'] ); 1147 1147 1148 1148 // Ensure the filter applies. … … 1159 1159 ) 1160 1160 ); 1161 $this->assert Equals( $customize_changeset_save_data_call_count + 1, $this->customize_changeset_save_data_call_count );1161 $this->assertSame( $customize_changeset_save_data_call_count + 1, $this->customize_changeset_save_data_call_count ); 1162 1162 1163 1163 // Publish the changeset: actions will be doubled since also trashed. … … 1206 1206 ); 1207 1207 $this->assertInternalType( 'array', $r ); 1208 $this->assert Equals( 'Do it live \o/', get_option( 'blogname' ) );1209 $this->assert Equals( 'trash', get_post_status( $post_id ) ); // Auto-trashed.1210 $this->assert Equals( $original_capabilities, wp_list_pluck( $manager->settings(), 'capability' ) );1208 $this->assertSame( 'Do it live \o/', get_option( 'blogname' ) ); 1209 $this->assertSame( 'trash', get_post_status( $post_id ) ); // Auto-trashed. 1210 $this->assertSame( $original_capabilities, wp_list_pluck( $manager->settings(), 'capability' ) ); 1211 1211 $this->assertContains( '<script>', get_post( $post_id )->post_content ); 1212 $this->assert Equals( $manager->changeset_uuid(), get_post( $post_id )->post_name, 'Expected that the "__trashed" suffix to not be added.' );1213 wp_set_current_user( self::$admin_user_id ); 1214 $this->assert Equals( 'publish', get_post_meta( $post_id, '_wp_trash_meta_status', true ) );1212 $this->assertSame( $manager->changeset_uuid(), get_post( $post_id )->post_name, 'Expected that the "__trashed" suffix to not be added.' ); 1213 wp_set_current_user( self::$admin_user_id ); 1214 $this->assertSame( 'publish', get_post_meta( $post_id, '_wp_trash_meta_status', true ) ); 1215 1215 $this->assertTrue( is_numeric( get_post_meta( $post_id, '_wp_trash_meta_time', true ) ) ); 1216 1216 1217 1217 foreach ( array_keys( $expected_actions ) as $action_name ) { 1218 $this->assert Equals( $expected_actions[ $action_name ] + $action_counts[ $action_name ], did_action( $action_name ), "Action: $action_name" );1218 $this->assertSame( $expected_actions[ $action_name ] + $action_counts[ $action_name ], did_action( $action_name ), "Action: $action_name" ); 1219 1219 } 1220 1220 … … 1294 1294 $autosave_revision = wp_get_post_autosave( $wp_customize->changeset_post_id(), get_current_user_id() ); 1295 1295 $saved_data = json_decode( $autosave_revision->post_content, true ); 1296 $this->assert Equals( $options['custom_html_1'], $saved_data['custom_html_1']['value'] );1297 $this->assert Equals( $options['custom_html_2'], $saved_data['custom_html_2']['value'] );1296 $this->assertSame( $options['custom_html_1'], $saved_data['custom_html_1']['value'] ); 1297 $this->assertSame( $options['custom_html_2'], $saved_data['custom_html_2']['value'] ); 1298 1298 1299 1299 // Update post to discard autosave. … … 1310 1310 $wp_customize = $this->get_manager_for_testing_json_corruption_protection( $uuid ); 1311 1311 $saved_data = json_decode( get_post( $wp_customize->changeset_post_id() )->post_content, true ); 1312 $this->assert Equals( $options['custom_html_1'], $saved_data['custom_html_1']['value'] );1313 $this->assert Equals( $options['custom_html_2'], $saved_data['custom_html_2']['value'] );1312 $this->assertSame( $options['custom_html_1'], $saved_data['custom_html_1']['value'] ); 1313 $this->assertSame( $options['custom_html_2'], $saved_data['custom_html_2']['value'] ); 1314 1314 1315 1315 /* … … 1320 1320 $revision = array_shift( $revisions ); 1321 1321 $saved_data = json_decode( $revision->post_content, true ); 1322 $this->assert Equals( $options['custom_html_1'], $saved_data['custom_html_1']['value'] );1323 $this->assert Equals( $options['custom_html_2'], $saved_data['custom_html_2']['value'] );1322 $this->assertSame( $options['custom_html_1'], $saved_data['custom_html_1']['value'] ); 1323 $this->assertSame( $options['custom_html_2'], $saved_data['custom_html_2']['value'] ); 1324 1324 1325 1325 /* … … 1477 1477 $manager->save_changeset_post( array( 'status' => 'publish' ) ); // Activate. 1478 1478 1479 $this->assert Equals( '#123456', $post_values['background_color'] );1480 $this->assert Equals( $preview_theme, get_stylesheet() );1481 $this->assert Equals( 'Hello Preview Theme', get_option( 'blogname' ) );1479 $this->assertSame( '#123456', $post_values['background_color'] ); 1480 $this->assertSame( $preview_theme, get_stylesheet() ); 1481 $this->assertSame( 'Hello Preview Theme', get_option( 'blogname' ) ); 1482 1482 } 1483 1483 … … 1514 1514 ); 1515 1515 $this->assertInternalType( 'array', $r ); 1516 $this->assert Equals(1516 $this->assertSame( 1517 1517 array_fill_keys( array( 'blogname', 'scratchpad', 'background_color' ), true ), 1518 1518 $r['setting_validities'] … … 1520 1520 $post_id = $wp_customize->find_changeset_post_id( $uuid ); 1521 1521 $data = json_decode( get_post( $post_id )->post_content, true ); 1522 $this->assert Equals( self::$admin_user_id, $data['blogname']['user_id'] );1523 $this->assert Equals( self::$admin_user_id, $data['scratchpad']['user_id'] );1524 $this->assert Equals( self::$admin_user_id, $data[ $this->manager->get_stylesheet() . '::background_color' ]['user_id'] );1522 $this->assertSame( self::$admin_user_id, $data['blogname']['user_id'] ); 1523 $this->assertSame( self::$admin_user_id, $data['scratchpad']['user_id'] ); 1524 $this->assertSame( self::$admin_user_id, $data[ $this->manager->get_stylesheet() . '::background_color' ]['user_id'] ); 1525 1525 1526 1526 // Attempt to save just one setting under a different user. … … 1541 1541 ); 1542 1542 $this->assertInternalType( 'array', $r ); 1543 $this->assert Equals(1543 $this->assertSame( 1544 1544 array_fill_keys( array( 'blogname', 'background_color' ), true ), 1545 1545 $r['setting_validities'] 1546 1546 ); 1547 1547 $data = json_decode( get_post( $post_id )->post_content, true ); 1548 $this->assert Equals( 'Admin 2 Title', $data['blogname']['value'] );1549 $this->assert Equals( $other_admin_user_id, $data['blogname']['user_id'] );1550 $this->assert Equals( 'Admin 1 Scratch', $data['scratchpad']['value'] );1551 $this->assert Equals( self::$admin_user_id, $data['scratchpad']['user_id'] );1552 $this->assert Equals( '#FFFFFF', $data[ $this->manager->get_stylesheet() . '::background_color' ]['value'] );1553 $this->assert Equals( $other_admin_user_id, $data[ $this->manager->get_stylesheet() . '::background_color' ]['user_id'] );1548 $this->assertSame( 'Admin 2 Title', $data['blogname']['value'] ); 1549 $this->assertSame( $other_admin_user_id, $data['blogname']['user_id'] ); 1550 $this->assertSame( 'Admin 1 Scratch', $data['scratchpad']['value'] ); 1551 $this->assertSame( self::$admin_user_id, $data['scratchpad']['user_id'] ); 1552 $this->assertSame( '#FFFFFF', $data[ $this->manager->get_stylesheet() . '::background_color' ]['value'] ); 1553 $this->assertSame( $other_admin_user_id, $data[ $this->manager->get_stylesheet() . '::background_color' ]['user_id'] ); 1554 1554 1555 1555 // Attempt to save now as under-privileged user. … … 1570 1570 ); 1571 1571 $this->assertInternalType( 'array', $r ); 1572 $this->assert Equals(1573 array_fill_keys( array( ' scratchpad', 'blogname' ), true ),1572 $this->assertSame( 1573 array_fill_keys( array( 'blogname', 'scratchpad' ), true ), 1574 1574 $r['setting_validities'] 1575 1575 ); 1576 1576 $data = json_decode( get_post( $post_id )->post_content, true ); 1577 $this->assert Equals( $other_admin_user_id, $data['blogname']['user_id'], 'Expected setting to be untouched.' );1578 $this->assert Equals( self::$subscriber_user_id, $data['scratchpad']['user_id'] );1579 $this->assert Equals( $other_admin_user_id, $data[ $this->manager->get_stylesheet() . '::background_color' ]['user_id'] );1577 $this->assertSame( $other_admin_user_id, $data['blogname']['user_id'], 'Expected setting to be untouched.' ); 1578 $this->assertSame( self::$subscriber_user_id, $data['scratchpad']['user_id'] ); 1579 $this->assertSame( $other_admin_user_id, $data[ $this->manager->get_stylesheet() . '::background_color' ]['user_id'] ); 1580 1580 1581 1581 // Manually update the changeset so that the user_id context is not included. … … 1610 1610 foreach ( array_keys( $data ) as $setting_id ) { 1611 1611 $setting_id = preg_replace( '/^.+::/', '', $setting_id ); 1612 $this->assert Equals( $save_counts[ $setting_id ] + 1, did_action( sprintf( 'customize_save_%s', $setting_id ) ), $setting_id );1612 $this->assertSame( $save_counts[ $setting_id ] + 1, did_action( sprintf( 'customize_save_%s', $setting_id ) ), $setting_id ); 1613 1613 } 1614 1614 $this->assertEqualSets( array( 'blogname', 'blogdescription', 'background_color', 'scratchpad' ), array_keys( $this->filtered_setting_current_user_ids ) ); 1615 $this->assert Equals( $other_admin_user_id, $this->filtered_setting_current_user_ids['blogname'] );1616 $this->assert Equals( 0, $this->filtered_setting_current_user_ids['blogdescription'] );1617 $this->assert Equals( self::$subscriber_user_id, $this->filtered_setting_current_user_ids['scratchpad'] );1618 $this->assert Equals( $other_admin_user_id, $this->filtered_setting_current_user_ids['background_color'] );1619 $this->assert Equals( 'Subscriber Scratch', get_option( 'scratchpad' ) );1615 $this->assertSame( $other_admin_user_id, $this->filtered_setting_current_user_ids['blogname'] ); 1616 $this->assertSame( 0, $this->filtered_setting_current_user_ids['blogdescription'] ); 1617 $this->assertSame( self::$subscriber_user_id, $this->filtered_setting_current_user_ids['scratchpad'] ); 1618 $this->assertSame( $other_admin_user_id, $this->filtered_setting_current_user_ids['background_color'] ); 1619 $this->assertSame( 'Subscriber Scratch', get_option( 'scratchpad' ) ); 1620 1620 } 1621 1621 … … 1747 1747 ); 1748 1748 $this->assertInstanceOf( 'WP_Error', $r['setting_validities']['unknownsetting'] ); 1749 $this->assert Equals( 'unrecognized', $r['setting_validities']['unknownsetting']->get_error_code() );1749 $this->assertSame( 'unrecognized', $r['setting_validities']['unknownsetting']->get_error_code() ); 1750 1750 $this->assertInstanceOf( 'WP_Error', $r['setting_validities']['blogterminated'] ); 1751 $this->assert Equals( 'unauthorized', $r['setting_validities']['blogterminated']->get_error_code() );1752 $this->assert Equals( $data, get_post( $wp_customize->changeset_post_id() )->post_content );1751 $this->assertSame( 'unauthorized', $r['setting_validities']['blogterminated']->get_error_code() ); 1752 $this->assertSame( $data, get_post( $wp_customize->changeset_post_id() )->post_content ); 1753 1753 1754 1754 // Test submitting data with changed and unchanged settings, creating a new instance so that the post_values are cleared. … … 1777 1777 1778 1778 // Note that blogfounded is not included among setting_validities because no value was supplied and it is not unrecognized/unauthorized. 1779 $this->assert Equals( array_fill_keys( array( 'blogname', 'blogdescription', 'scratchpad' ), true ), $r['setting_validities'], 'Expected blogname even though unchanged.' );1779 $this->assertSame( array_fill_keys( array( 'blogname', 'blogdescription', 'scratchpad' ), true ), $r['setting_validities'], 'Expected blogname even though unchanged.' ); 1780 1780 1781 1781 $data = json_decode( get_post( $wp_customize->changeset_post_id() )->post_content, true ); 1782 1782 1783 $this->assert Equals( self::$admin_user_id, $data['blogname']['user_id'], 'Expected unchanged user_id since value was unchanged.' );1784 $this->assert Equals( $other_admin_user_id, $data['blogdescription']['user_id'] );1785 $this->assert Equals( $other_admin_user_id, $data['blogfounded']['user_id'] );1786 $this->assert Equals( $other_admin_user_id, $data['scratchpad']['user_id'] );1783 $this->assertSame( self::$admin_user_id, $data['blogname']['user_id'], 'Expected unchanged user_id since value was unchanged.' ); 1784 $this->assertSame( $other_admin_user_id, $data['blogdescription']['user_id'] ); 1785 $this->assertSame( $other_admin_user_id, $data['blogfounded']['user_id'] ); 1786 $this->assertSame( $other_admin_user_id, $data['scratchpad']['user_id'] ); 1787 1787 } 1788 1788 … … 1856 1856 ); 1857 1857 $this->assertInstanceOf( 'WP_Error', $r ); 1858 $this->assert Equals( 'illegal_autosave_with_date_gmt', $r->get_error_code() );1858 $this->assertSame( 'illegal_autosave_with_date_gmt', $r->get_error_code() ); 1859 1859 1860 1860 // Fail: illegal_autosave_with_status. … … 1865 1865 ) 1866 1866 ); 1867 $this->assert Equals( 'illegal_autosave_with_status', $r->get_error_code() );1867 $this->assertSame( 'illegal_autosave_with_status', $r->get_error_code() ); 1868 1868 1869 1869 // Fail: illegal_autosave_with_non_current_user. … … 1874 1874 ) 1875 1875 ); 1876 $this->assert Equals( 'illegal_autosave_with_non_current_user', $r->get_error_code() );1876 $this->assertSame( 'illegal_autosave_with_non_current_user', $r->get_error_code() ); 1877 1877 1878 1878 // Try autosave. … … 1961 1961 do_action( 'customize_register', $wp_customize ); 1962 1962 $wp_customize->save_changeset_post( array( 'status' => 'publish' ) ); 1963 $this->assert Equals( 'Unfiltered<script>evil</script>', get_option( 'scratchpad' ) );1963 $this->assertSame( 'Unfiltered<script>evil</script>', get_option( 'scratchpad' ) ); 1964 1964 1965 1965 // Attempt scratchpad with user who doesn't have unfiltered_html. … … 1977 1977 do_action( 'customize_register', $wp_customize ); 1978 1978 $wp_customize->save_changeset_post( array( 'status' => 'publish' ) ); 1979 $this->assert Equals( 'Unfilteredevil', get_option( 'scratchpad' ) );1979 $this->assertSame( 'Unfilteredevil', get_option( 'scratchpad' ) ); 1980 1980 1981 1981 // Attempt publishing scratchpad as anonymous user when changeset was set by privileged user. … … 1994 1994 $wp_customize = null; 1995 1995 unset( $GLOBALS['wp_actions']['customize_register'] ); 1996 $this->assert Equals( 'Unfilteredevil', apply_filters( 'content_save_pre', 'Unfiltered<script>evil</script>' ) );1996 $this->assertSame( 'Unfilteredevil', apply_filters( 'content_save_pre', 'Unfiltered<script>evil</script>' ) ); 1997 1997 wp_publish_post( $changeset_post_id ); // @todo If wp_update_post() is used here, then kses will corrupt the post_content. 1998 $this->assert Equals( 'Unfiltered<script>evil</script>', get_option( 'scratchpad' ) );1998 $this->assertSame( 'Unfiltered<script>evil</script>', get_option( 'scratchpad' ) ); 1999 1999 } 2000 2000 … … 2048 2048 // Ensure that the value has actually been written to the DB. 2049 2049 $updated_sidebars_widgets = get_option( 'sidebars_widgets' ); 2050 $this->assert Equals( $new_sidebar_1, $updated_sidebars_widgets['sidebar-1'] );2050 $this->assertSame( $new_sidebar_1, $updated_sidebars_widgets['sidebar-1'] ); 2051 2051 } 2052 2052 … … 2100 2100 $r = $manager->save_changeset_post( $args ); 2101 2101 $this->assertInstanceOf( 'WP_Error', $r ); 2102 $this->assert Equals( 'json_parse_error', $r->get_error_code() );2102 $this->assertSame( 'json_parse_error', $r->get_error_code() ); 2103 2103 2104 2104 wp_update_post( … … 2110 2110 $r = $manager->save_changeset_post( $args ); 2111 2111 $this->assertInstanceOf( 'WP_Error', $r ); 2112 $this->assert Equals( 'expected_array', $r->get_error_code() );2112 $this->assertSame( 'expected_array', $r->get_error_code() ); 2113 2113 } 2114 2114 … … 2218 2218 $this->assertFalse( $wp_customize->is_cross_domain() ); 2219 2219 $allowed = $wp_customize->get_allowed_urls(); 2220 $this->assert Equals( $allowed, array( home_url( '/', 'http' ) ) );2220 $this->assertSame( $allowed, array( home_url( '/', 'http' ) ) ); 2221 2221 2222 2222 add_filter( 'customize_allowed_urls', array( $this, 'filter_customize_allowed_urls' ) ); … … 2277 2277 $_POST['customized'] = wp_slash( wp_json_encode( $customized ) ); 2278 2278 $post_values = $manager->unsanitized_post_values(); 2279 $this->assert Equals( $customized, $post_values );2279 $this->assertSame( $customized, $post_values ); 2280 2280 $this->assertEmpty( $manager->unsanitized_post_values( array( 'exclude_post_data' => true ) ) ); 2281 2281 2282 2282 $manager->set_post_value( 'foo', 'BAR' ); 2283 2283 $post_values = $manager->unsanitized_post_values(); 2284 $this->assert Equals( 'BAR', $post_values['foo'] );2284 $this->assertSame( 'BAR', $post_values['foo'] ); 2285 2285 $this->assertEmpty( $manager->unsanitized_post_values( array( 'exclude_post_data' => true ) ) ); 2286 2286 … … 2346 2346 $this->assertArrayNotHasKey( 'background_color', $manager->unsanitized_post_values() ); 2347 2347 2348 $this->assert Equals(2348 $this->assertSame( 2349 2349 array( 2350 2350 'blogname' => 'Changeset Title', … … 2353 2353 $manager->unsanitized_post_values() 2354 2354 ); 2355 $this->assert Equals(2355 $this->assertSame( 2356 2356 array( 2357 2357 'blogdescription' => 'Post Input Tagline', … … 2361 2361 2362 2362 $manager->set_post_value( 'blogdescription', 'Post Override Tagline' ); 2363 $this->assert Equals(2363 $this->assertSame( 2364 2364 array( 2365 2365 'blogname' => 'Changeset Title', … … 2369 2369 ); 2370 2370 2371 $this->assert Equals(2371 $this->assertSame( 2372 2372 array( 2373 2373 'blogname' => 'Changeset Title', … … 2402 2402 $this->assertNotEmpty( $values ); 2403 2403 $this->assertArrayHasKey( 'background_color', $values ); 2404 $this->assert Equals( '#000000', $values['background_color'] );2404 $this->assertSame( '#000000', $values['background_color'] ); 2405 2405 2406 2406 $values = $manager->unsanitized_post_values( … … 2431 2431 $manager->add_setting( 'foo', array( 'default' => 'foo_default' ) ); 2432 2432 $foo_setting = $manager->get_setting( 'foo' ); 2433 $this->assert Equals( 'foo_default', $manager->get_setting( 'foo' )->value(), 'Expected non-previewed setting to return default when value() method called.' );2434 $this->assert Equals( $posted_settings['foo'], $manager->post_value( $foo_setting, 'post_value_foo_default' ), 'Expected post_value($foo_setting) to return value supplied in $_POST[customized][foo]' );2433 $this->assertSame( 'foo_default', $manager->get_setting( 'foo' )->value(), 'Expected non-previewed setting to return default when value() method called.' ); 2434 $this->assertSame( $posted_settings['foo'], $manager->post_value( $foo_setting, 'post_value_foo_default' ), 'Expected post_value($foo_setting) to return value supplied in $_POST[customized][foo]' ); 2435 2435 2436 2436 $manager->add_setting( 'bar', array( 'default' => 'bar_default' ) ); 2437 2437 $bar_setting = $manager->get_setting( 'bar' ); 2438 $this->assert Equals( 'post_value_bar_default', $manager->post_value( $bar_setting, 'post_value_bar_default' ), 'Expected post_value($bar_setting, $default) to return $default since no value supplied in $_POST[customized][bar]' );2438 $this->assertSame( 'post_value_bar_default', $manager->post_value( $bar_setting, 'post_value_bar_default' ), 'Expected post_value($bar_setting, $default) to return $default since no value supplied in $_POST[customized][bar]' ); 2439 2439 } 2440 2440 … … 2454 2454 ) 2455 2455 ); 2456 $this->assert Equals( $default_value, $this->manager->post_value( $setting, $default_value ) );2457 $this->assert Equals( $default_value, $setting->post_value( $default_value ) );2456 $this->assertSame( $default_value, $this->manager->post_value( $setting, $default_value ) ); 2457 $this->assertSame( $default_value, $setting->post_value( $default_value ) ); 2458 2458 2459 2459 $post_value = 'bar'; 2460 2460 $this->manager->set_post_value( 'foo', $post_value ); 2461 $this->assert Equals( strtoupper( $post_value ), $this->manager->post_value( $setting, $default_value ) );2462 $this->assert Equals( strtoupper( $post_value ), $setting->post_value( $default_value ) );2461 $this->assertSame( strtoupper( $post_value ), $this->manager->post_value( $setting, $default_value ) ); 2462 $this->assertSame( strtoupper( $post_value ), $setting->post_value( $default_value ) ); 2463 2463 2464 2464 $this->manager->set_post_value( 'foo', 'return_wp_error_in_sanitize' ); 2465 $this->assert Equals( $default_value, $this->manager->post_value( $setting, $default_value ) );2466 $this->assert Equals( $default_value, $setting->post_value( $default_value ) );2465 $this->assertSame( $default_value, $this->manager->post_value( $setting, $default_value ) ); 2466 $this->assertSame( $default_value, $setting->post_value( $default_value ) ); 2467 2467 2468 2468 $this->manager->set_post_value( 'foo', 'return_null_in_sanitize' ); 2469 $this->assert Equals( $default_value, $this->manager->post_value( $setting, $default_value ) );2470 $this->assert Equals( $default_value, $setting->post_value( $default_value ) );2469 $this->assertSame( $default_value, $this->manager->post_value( $setting, $default_value ) ); 2470 $this->assertSame( $default_value, $setting->post_value( $default_value ) ); 2471 2471 2472 2472 $post_value = '<script>evil</script>'; 2473 2473 $this->manager->set_post_value( 'foo', $post_value ); 2474 $this->assert Equals( $default_value, $this->manager->post_value( $setting, $default_value ) );2475 $this->assert Equals( $default_value, $setting->post_value( $default_value ) );2474 $this->assertSame( $default_value, $this->manager->post_value( $setting, $default_value ) ); 2475 $this->assertSame( $default_value, $setting->post_value( $default_value ) ); 2476 2476 } 2477 2477 … … 2523 2523 ) 2524 2524 ); 2525 $this->assert Equals( $default_value, $this->manager->post_value( $setting, $default_value ) );2526 $this->assert Equals( $default_value, $setting->post_value( $default_value ) );2525 $this->assertSame( $default_value, $this->manager->post_value( $setting, $default_value ) ); 2526 $this->assertSame( $default_value, $setting->post_value( $default_value ) ); 2527 2527 2528 2528 $post_value = '42'; … … 2575 2575 $validities = $this->manager->validate_setting_values( $this->manager->unsanitized_post_values() ); 2576 2576 $this->assertCount( 1, $validities ); 2577 $this->assert Equals( array( 'foo' => true ), $validities );2577 $this->assertSame( array( 'foo' => true ), $validities ); 2578 2578 2579 2579 $this->manager->set_post_value( 'foo', 'return_wp_error_in_sanitize' ); … … 2583 2583 $this->assertInstanceOf( 'WP_Error', $invalid_settings[ $setting->id ] ); 2584 2584 $error = $invalid_settings[ $setting->id ]; 2585 $this->assert Equals( 'invalid_value_in_sanitize', $error->get_error_code() );2586 $this->assert Equals( array( 'source' => 'filter_customize_sanitize_foo' ), $error->get_error_data() );2585 $this->assertSame( 'invalid_value_in_sanitize', $error->get_error_code() ); 2586 $this->assertSame( array( 'source' => 'filter_customize_sanitize_foo' ), $error->get_error_data() ); 2587 2587 2588 2588 $this->manager->set_post_value( 'foo', 'return_null_in_sanitize' ); … … 2600 2600 $this->assertInstanceOf( 'WP_Error', $invalid_settings[ $setting->id ] ); 2601 2601 $error = $invalid_settings[ $setting->id ]; 2602 $this->assert Equals( 'invalid_value_in_validate', $error->get_error_code() );2603 $this->assert Equals( array( 'source' => 'filter_customize_validate_foo' ), $error->get_error_data() );2602 $this->assertSame( 'invalid_value_in_validate', $error->get_error_code() ); 2603 $this->assertSame( array( 'source' => 'filter_customize_validate_foo' ), $error->get_error_data() ); 2604 2604 } 2605 2605 … … 2627 2627 $validity = $setting_validities[ $setting->id ]; 2628 2628 $this->assertInstanceOf( 'WP_Error', $validity ); 2629 $this->assert Equals( 'minlength', $validity->get_error_code() );2629 $this->assertSame( 'minlength', $validity->get_error_code() ); 2630 2630 } 2631 2631 … … 2651 2651 $error = $validities['unknown']; 2652 2652 $this->assertInstanceOf( 'WP_Error', $error ); 2653 $this->assert Equals( 'unrecognized', $error->get_error_code() );2653 $this->assertSame( 'unrecognized', $error->get_error_code() ); 2654 2654 2655 2655 $this->manager->get_setting( 'blogname' )->capability = 'do_not_allow'; … … 2661 2661 $error = $validities['blogname']; 2662 2662 $this->assertInstanceOf( 'WP_Error', $error ); 2663 $this->assert Equals( 'unauthorized', $error->get_error_code() );2663 $this->assertSame( 'unauthorized', $error->get_error_code() ); 2664 2664 } 2665 2665 … … 2700 2700 $validities = $this->manager->validate_setting_values( $this->manager->unsanitized_post_values() ); 2701 2701 $this->assertCount( 1, $validities ); 2702 $this->assert Equals( array( 'numeric' => true ), $validities );2702 $this->assertSame( array( 'numeric' => true ), $validities ); 2703 2703 } 2704 2704 … … 2719 2719 $this->assertArrayHasKey( $code, $validity ); 2720 2720 $this->assertInternalType( 'array', $validity[ $code ] ); 2721 $this->assert Equals( join( ' ', $messages ), $validity[ $code ]['message'] );2721 $this->assertSame( join( ' ', $messages ), $validity[ $code ]['message'] ); 2722 2722 $this->assertArrayHasKey( 'data', $validity[ $code ] ); 2723 $this->assert Equals( $validity[ $code ]['data'], $error->get_error_data( $code ) );2723 $this->assertSame( $validity[ $code ]['data'], $error->get_error_data( $code ) ); 2724 2724 } 2725 2725 $this->assertArrayHasKey( 'number', $validity['bad_number']['data'] ); 2726 $this->assert Equals( 123, $validity['bad_number']['data']['number'] );2726 $this->assertSame( 123, $validity['bad_number']['data']['number'] ); 2727 2727 } 2728 2728 … … 2747 2747 $this->manager->set_post_value( $setting->id, '123abc' ); 2748 2748 $this->assertCount( 2, $this->captured_customize_post_value_set_actions ); 2749 $this->assert Equals( 'customize_post_value_set_foo', $this->captured_customize_post_value_set_actions[0]['action'] );2750 $this->assert Equals( 'customize_post_value_set', $this->captured_customize_post_value_set_actions[1]['action'] );2751 $this->assert Equals( array( '123abc', $this->manager ), $this->captured_customize_post_value_set_actions[0]['args'] );2752 $this->assert Equals( array( $setting->id, '123abc', $this->manager ), $this->captured_customize_post_value_set_actions[1]['args'] );2749 $this->assertSame( 'customize_post_value_set_foo', $this->captured_customize_post_value_set_actions[0]['action'] ); 2750 $this->assertSame( 'customize_post_value_set', $this->captured_customize_post_value_set_actions[1]['action'] ); 2751 $this->assertSame( array( '123abc', $this->manager ), $this->captured_customize_post_value_set_actions[0]['args'] ); 2752 $this->assertSame( array( $setting->id, '123abc', $this->manager ), $this->captured_customize_post_value_set_actions[1]['args'] ); 2753 2753 2754 2754 $unsanitized = $this->manager->unsanitized_post_values(); 2755 2755 $this->assertArrayHasKey( $setting->id, $unsanitized ); 2756 2756 2757 $this->assert Equals( '123abc', $unsanitized[ $setting->id ] );2758 $this->assert Equals( 123, $setting->post_value() );2757 $this->assertSame( '123abc', $unsanitized[ $setting->id ] ); 2758 $this->assertSame( 123, $setting->post_value() ); 2759 2759 } 2760 2760 … … 2807 2807 $manager->add_dynamic_settings( $setting_ids ); 2808 2808 $this->assertNotEmpty( $manager->get_setting( 'bar' ), 'Expected bar setting to be created since filters were added.' ); 2809 $this->assert Equals( 'foo_default', $manager->get_setting( 'foo' )->default, 'Expected static foo setting to not get overridden by dynamic setting.' );2810 $this->assert Equals( 'dynamic_bar_default', $manager->get_setting( 'bar' )->default, 'Expected dynamic setting bar to have default providd by filter.' );2809 $this->assertSame( 'foo_default', $manager->get_setting( 'foo' )->default, 'Expected static foo setting to not get overridden by dynamic setting.' ); 2810 $this->assertSame( 'dynamic_bar_default', $manager->get_setting( 'bar' )->default, 'Expected dynamic setting bar to have default providd by filter.' ); 2811 2811 } 2812 2812 … … 2926 2926 */ 2927 2927 function filter_customize_dynamic_setting_class_for_test_dynamic_settings( $setting_class, $setting_id, $setting_args ) { 2928 $this->assert Equals( 'WP_Customize_Setting', $setting_class );2928 $this->assertSame( 'WP_Customize_Setting', $setting_class ); 2929 2929 $this->assertInternalType( 'string', $setting_id ); 2930 2930 $this->assertInternalType( 'array', $setting_args ); … … 2949 2949 */ 2950 2950 function test_preview_url() { 2951 $this->assert Equals( home_url( '/' ), $this->manager->get_preview_url() );2951 $this->assertSame( home_url( '/' ), $this->manager->get_preview_url() ); 2952 2952 $preview_url = home_url( '/foo/bar/baz/' ); 2953 2953 $this->manager->set_preview_url( $preview_url ); 2954 $this->assert Equals( $preview_url, $this->manager->get_preview_url() );2954 $this->assertSame( $preview_url, $this->manager->get_preview_url() ); 2955 2955 $this->manager->set_preview_url( 'http://illegalsite.example.com/food/' ); 2956 $this->assert Equals( home_url( '/' ), $this->manager->get_preview_url() );2956 $this->assertSame( home_url( '/' ), $this->manager->get_preview_url() ); 2957 2957 } 2958 2958 … … 2965 2965 function test_return_url() { 2966 2966 wp_set_current_user( self::factory()->user->create( array( 'role' => 'author' ) ) ); 2967 $this->assert Equals( home_url( '/' ), $this->manager->get_return_url() );2967 $this->assertSame( home_url( '/' ), $this->manager->get_return_url() ); 2968 2968 2969 2969 wp_set_current_user( self::$admin_user_id ); 2970 2970 $this->assertTrue( current_user_can( 'edit_theme_options' ) ); 2971 $this->assert Equals( home_url( '/' ), $this->manager->get_return_url() );2971 $this->assertSame( home_url( '/' ), $this->manager->get_return_url() ); 2972 2972 2973 2973 $preview_url = home_url( '/foo/' ); 2974 2974 $this->manager->set_preview_url( $preview_url ); 2975 $this->assert Equals( $preview_url, $this->manager->get_return_url() );2975 $this->assertSame( $preview_url, $this->manager->get_return_url() ); 2976 2976 2977 2977 $_SERVER['HTTP_REFERER'] = wp_slash( admin_url( 'customize.php' ) ); 2978 $this->assert Equals( $preview_url, $this->manager->get_return_url() );2978 $this->assertSame( $preview_url, $this->manager->get_return_url() ); 2979 2979 2980 2980 // See #35355. 2981 2981 $_SERVER['HTTP_REFERER'] = wp_slash( admin_url( 'wp-login.php' ) ); 2982 $this->assert Equals( $preview_url, $this->manager->get_return_url() );2982 $this->assertSame( $preview_url, $this->manager->get_return_url() ); 2983 2983 2984 2984 $url = home_url( '/referred/' ); 2985 2985 $_SERVER['HTTP_REFERER'] = wp_slash( $url ); 2986 $this->assert Equals( $url, $this->manager->get_return_url() );2986 $this->assertSame( $url, $this->manager->get_return_url() ); 2987 2987 2988 2988 $url = 'http://badreferer.example.com/'; 2989 2989 $_SERVER['HTTP_REFERER'] = wp_slash( $url ); 2990 2990 $this->assertNotEquals( $url, $this->manager->get_return_url() ); 2991 $this->assert Equals( $preview_url, $this->manager->get_return_url() );2991 $this->assertSame( $preview_url, $this->manager->get_return_url() ); 2992 2992 2993 2993 $this->manager->set_return_url( admin_url( 'edit.php?trashed=1' ) ); 2994 $this->assert Equals( admin_url( 'edit.php' ), $this->manager->get_return_url() );2994 $this->assertSame( admin_url( 'edit.php' ), $this->manager->get_return_url() ); 2995 2995 } 2996 2996 … … 3000 3000 function test_return_url_with_deactivated_theme() { 3001 3001 $this->manager->set_return_url( admin_url( 'themes.php?page=mytheme_documentation' ) ); 3002 $this->assert Equals( admin_url( 'themes.php' ), $this->manager->get_return_url() );3002 $this->assertSame( admin_url( 'themes.php' ), $this->manager->get_return_url() ); 3003 3003 } 3004 3004 … … 3017 3017 $autofocus = array( 'control' => 'blogname' ); 3018 3018 $this->manager->set_autofocus( $autofocus ); 3019 $this->assert Equals( $autofocus, $this->manager->get_autofocus() );3019 $this->assertSame( $autofocus, $this->manager->get_autofocus() ); 3020 3020 3021 3021 $autofocus = array( 'section' => 'colors' ); 3022 3022 $this->manager->set_autofocus( $autofocus ); 3023 $this->assert Equals( $autofocus, $this->manager->get_autofocus() );3023 $this->assertSame( $autofocus, $this->manager->get_autofocus() ); 3024 3024 3025 3025 $autofocus = array( 'panel' => 'widgets' ); 3026 3026 $this->manager->set_autofocus( $autofocus ); 3027 $this->assert Equals( $autofocus, $this->manager->get_autofocus() );3027 $this->assertSame( $autofocus, $this->manager->get_autofocus() ); 3028 3028 3029 3029 $autofocus = array( 'control' => array( 'blogname', 'blogdescription' ) ); … … 3046 3046 $nonces = $this->manager->get_nonces(); 3047 3047 $this->assertArrayHasKey( 'foo', $nonces ); 3048 $this->assert Equals( wp_create_nonce( 'foo' ), $nonces['foo'] );3048 $this->assertSame( wp_create_nonce( 'foo' ), $nonces['foo'] ); 3049 3049 } 3050 3050 … … 3091 3091 3092 3092 $this->assertEqualSets( array( 'theme', 'url', 'browser', 'panels', 'sections', 'nonce', 'autofocus', 'documentTitleTmpl', 'previewableDevices', 'changeset', 'timeouts', 'dateFormat', 'timeFormat', 'initialClientTimestamp', 'initialServerDate', 'initialServerTimestamp', 'l10n' ), array_keys( $data ) ); 3093 $this->assert Equals( $autofocus, $data['autofocus'] );3093 $this->assertSame( $autofocus, $data['autofocus'] ); 3094 3094 $this->assertArrayHasKey( 'save', $data['nonce'] ); 3095 3095 $this->assertArrayHasKey( 'preview', $data['nonce'] ); … … 3149 3149 $content = ob_get_clean(); 3150 3150 3151 $this->assert Equals( 1, preg_match( '/var _wpCustomizeSettings = ({.+});/', $content, $matches ) );3151 $this->assertSame( 1, preg_match( '/var _wpCustomizeSettings = ({.+});/', $content, $matches ) ); 3152 3152 $settings = json_decode( $matches[1], true ); 3153 3153 … … 3266 3266 3267 3267 $sorted_control_ids = wp_list_pluck( $manager->get_section( $section_id )->controls, 'id' ); 3268 $this->assert Equals( $added_control_ids, $sorted_control_ids );3268 $this->assertSame( $added_control_ids, $sorted_control_ids ); 3269 3269 } 3270 3270 … … 3286 3286 3287 3287 $this->assertInstanceOf( 'WP_Customize_Section', $result_section ); 3288 $this->assert Equals( $section_id, $result_section->id );3288 $this->assertSame( $section_id, $result_section->id ); 3289 3289 3290 3290 $section = new WP_Customize_Section( … … 3299 3299 3300 3300 $this->assertInstanceOf( 'WP_Customize_Section', $result_section ); 3301 $this->assert Equals( $section_id, $result_section->id );3302 $this->assert Equals( $section, $result_section );3301 $this->assertSame( $section_id, $result_section->id ); 3302 $this->assertSame( $section, $result_section ); 3303 3303 } 3304 3304 … … 3314 3314 3315 3315 $this->assertInstanceOf( 'WP_Customize_Setting', $result_setting ); 3316 $this->assert Equals( $setting_id, $result_setting->id );3316 $this->assertSame( $setting_id, $result_setting->id ); 3317 3317 3318 3318 $setting = new WP_Customize_Setting( $manager, $setting_id ); … … 3320 3320 3321 3321 $this->assertInstanceOf( 'WP_Customize_Setting', $result_setting ); 3322 $this->assert Equals( $setting, $result_setting );3323 $this->assert Equals( $setting_id, $result_setting->id );3322 $this->assertSame( $setting, $result_setting ); 3323 $this->assertSame( $setting_id, $result_setting->id ); 3324 3324 } 3325 3325 … … 3332 3332 $setting_id = 'dynamic'; 3333 3333 $setting = $manager->add_setting( $setting_id ); 3334 $this->assert Equals( 'WP_Customize_Setting', get_class( $setting ) );3334 $this->assertSame( 'WP_Customize_Setting', get_class( $setting ) ); 3335 3335 $this->assertObjectNotHasAttribute( 'custom', $setting ); 3336 3336 $manager->remove_setting( $setting_id ); … … 3339 3339 add_filter( 'customize_dynamic_setting_args', array( $this, 'return_dynamic_customize_setting_args' ), 10, 2 ); 3340 3340 $setting = $manager->add_setting( $setting_id ); 3341 $this->assert Equals( 'Test_Dynamic_Customize_Setting', get_class( $setting ) );3341 $this->assertSame( 'Test_Dynamic_Customize_Setting', get_class( $setting ) ); 3342 3342 $this->assertObjectHasAttribute( 'custom', $setting ); 3343 $this->assert Equals( 'foo', $setting->custom );3343 $this->assertSame( 'foo', $setting->custom ); 3344 3344 } 3345 3345 … … 3391 3391 3392 3392 $this->assertInstanceOf( 'WP_Customize_Panel', $result_panel ); 3393 $this->assert Equals( $panel_id, $result_panel->id );3393 $this->assertSame( $panel_id, $result_panel->id ); 3394 3394 3395 3395 $panel = new WP_Customize_Panel( … … 3403 3403 3404 3404 $this->assertInstanceOf( 'WP_Customize_Panel', $result_panel ); 3405 $this->assert Equals( $panel, $result_panel );3406 $this->assert Equals( $panel_id, $result_panel->id );3405 $this->assertSame( $panel, $result_panel ); 3406 $this->assertSame( $panel_id, $result_panel->id ); 3407 3407 } 3408 3408 … … 3434 3434 ); 3435 3435 $this->assertInstanceOf( 'WP_Customize_Control', $result_control ); 3436 $this->assert Equals( $control_id, $result_control->id );3436 $this->assertSame( $control_id, $result_control->id ); 3437 3437 3438 3438 $control = new WP_Customize_Control( … … 3448 3448 3449 3449 $this->assertInstanceOf( 'WP_Customize_Control', $result_control ); 3450 $this->assert Equals( $control, $result_control );3451 $this->assert Equals( $control_id, $result_control->id );3450 $this->assertSame( $control, $result_control ); 3451 $this->assertSame( $control_id, $result_control->id ); 3452 3452 } 3453 3453 … … 3545 3545 3546 3546 $result = $this->manager->controls(); 3547 $this->assert Equals( $controls_sorted, array_keys( $result ) );3547 $this->assertSame( $controls_sorted, array_keys( $result ) ); 3548 3548 } 3549 3549 … … 3574 3574 3575 3575 $result = $this->manager->sections(); 3576 $this->assert Equals( $sections_sorted, array_keys( $result ) );3576 $this->assertSame( $sections_sorted, array_keys( $result ) ); 3577 3577 } 3578 3578 … … 3603 3603 3604 3604 $result = $this->manager->panels(); 3605 $this->assert Equals( $panels_sorted, array_keys( $result ) );3605 $this->assertSame( $panels_sorted, array_keys( $result ) ); 3606 3606 } 3607 3607 … … 3627 3627 foreach ( $whitespaces as $whitespace ) { 3628 3628 $sanitized = $setting->sanitize( $whitespace . $video_url . $whitespace ); 3629 $this->assert Equals( $video_url, $sanitized );3629 $this->assertSame( $video_url, $sanitized ); 3630 3630 } 3631 3631 }
Note: See TracChangeset
for help on using the changeset viewer.