WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (17 months ago)
Author:
SergeyBiryukov
Message:

Tests: First pass at using assertSame() instead of assertEquals() in most of the unit tests.

This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using assertSame() should generally be preferred to assertEquals() where appropriate, to make the tests more reliable.

Props johnbillion, jrf, SergeyBiryukov.
See #38266.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/manager.php

    r48858 r48937  
    120120            )
    121121        );
    122         $this->assertEquals( $uuid, $wp_customize->changeset_uuid() );
    123         $this->assertEquals( $theme, $wp_customize->get_stylesheet() );
    124         $this->assertEquals( $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() );
    125125        $this->assertFalse( $wp_customize->autosaved() );
    126126        $this->assertTrue( $wp_customize->branching() );
     
    138138        $_REQUEST['customize_messenger_channel'] = $messenger_channel;
    139139        $wp_customize                            = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) );
    140         $this->assertEquals( $theme, $wp_customize->get_stylesheet() );
    141         $this->assertEquals( $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() );
    142142
    143143        $theme                       = 'twentyfourteen';
    144144        $_REQUEST['customize_theme'] = $theme;
    145145        $wp_customize                = new WP_Customize_Manager();
    146         $this->assertEquals( $theme, $wp_customize->get_stylesheet() );
     146        $this->assertSame( $theme, $wp_customize->get_stylesheet() );
    147147        $this->assertTrue( wp_is_uuid( $wp_customize->changeset_uuid(), 4 ) );
    148148    }
     
    199199            )
    200200        );
    201         $this->assertEquals( $uuid2, $wp_customize->changeset_uuid() );
    202         $this->assertEquals( $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() );
    203203
    204204        $wp_customize = new WP_Customize_Manager(
     
    265265        update_option( 'fresh_site', '1' );
    266266        $wp_customize->setup_theme();
    267         $this->assertEquals( 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' ) ) );
    268268    }
    269269
     
    280280        update_option( 'fresh_site', '1' );
    281281        do_action( 'customize_save_after', $wp_customize );
    282         $this->assertEquals( '0', get_option( 'fresh_site' ) );
     282        $this->assertSame( '0', get_option( 'fresh_site' ) );
    283283
    284284        // Simulate a new, uncached request.
     
    334334    function test_settings_previewed() {
    335335        $wp_customize = new WP_Customize_Manager( array( 'settings_previewed' => false ) );
    336         $this->assertSame( false, $wp_customize->settings_previewed() );
     336        $this->assertFalse( $wp_customize->settings_previewed() );
    337337
    338338        $wp_customize = new WP_Customize_Manager();
    339         $this->assertSame( true, $wp_customize->settings_previewed() );
     339        $this->assertTrue( $wp_customize->settings_previewed() );
    340340    }
    341341
     
    388388        $uuid         = wp_generate_uuid4();
    389389        $wp_customize = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) );
    390         $this->assertEquals( $uuid, $wp_customize->changeset_uuid() );
     390        $this->assertSame( $uuid, $wp_customize->changeset_uuid() );
    391391    }
    392392
     
    407407        $wp_customize->wp_loaded();
    408408        $this->assertFalse( $wp_customize->is_preview() );
    409         $this->assertEquals( $title, $wp_customize->get_setting( 'blogname' )->value() );
    410         $this->assertEquals( $title, get_option( 'blogname' ) );
     409        $this->assertSame( $title, $wp_customize->get_setting( 'blogname' )->value() );
     410        $this->assertSame( $title, get_option( 'blogname' ) );
    411411    }
    412412
     
    430430        $wp_customize = new WP_Customize_Manager();
    431431        $this->assertNull( $wp_customize->find_changeset_post_id( wp_generate_uuid4() ) );
    432         $this->assertEquals( $post_id, $wp_customize->find_changeset_post_id( $uuid ) );
     432        $this->assertSame( $post_id, $wp_customize->find_changeset_post_id( $uuid ) );
    433433
    434434        // Verify that the found post ID was cached under the given UUID, not the manager's UUID.
     
    457457            )
    458458        );
    459         $this->assertEquals( $post_id, $wp_customize->changeset_post_id() );
     459        $this->assertSame( $post_id, $wp_customize->changeset_post_id() );
    460460    }
    461461
     
    470470        $uuid         = wp_generate_uuid4();
    471471        $wp_customize = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) );
    472         $this->assertEquals( array(), $wp_customize->changeset_data() );
     472        $this->assertSame( array(), $wp_customize->changeset_data() );
    473473
    474474        $uuid = wp_generate_uuid4();
     
    486486        );
    487487        $wp_customize = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) );
    488         $this->assertEquals( $data, $wp_customize->changeset_data() );
     488        $this->assertSame( $data, $wp_customize->changeset_data() );
    489489
    490490        // Autosave.
     
    507507        $wp_customize->register_controls(); // That is, settings.
    508508        $this->assertFalse( $wp_customize->autosaved() );
    509         $this->assertEquals( $data, $wp_customize->changeset_data() );
     509        $this->assertSame( $data, $wp_customize->changeset_data() );
    510510
    511511        // No change to data if not requesting autosave.
     
    518518        $this->assertTrue( $wp_customize->autosaved() );
    519519        $this->assertNotEquals( $data, $wp_customize->changeset_data() );
    520         $this->assertEquals(
     520        $this->assertSame(
    521521            array_merge(
    522522                wp_list_pluck( $data, 'value' ),
     
    534534            )
    535535        );
    536         $this->assertEquals( $data, $wp_customize->changeset_data() );
     536        $this->assertSame( $data, $wp_customize->changeset_data() );
    537537    }
    538538
     
    684684        }
    685685
    686         $this->assertEquals( 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]'] );
    687687
    688688        $posts_by_name = array();
     
    694694            $post = get_post( $post_id );
    695695            if ( $post->ID === $existing_published_home_page_id ) {
    696                 $this->assertEquals( 'publish', $post->post_status );
     696                $this->assertSame( 'publish', $post->post_status );
    697697            } elseif ( $post->ID === $existing_canola_attachment_id ) {
    698                 $this->assertEquals( 'inherit', $post->post_status );
     698                $this->assertSame( 'inherit', $post->post_status );
    699699            } else {
    700                 $this->assertEquals( 'auto-draft', $post->post_status );
     700                $this->assertSame( 'auto-draft', $post->post_status );
    701701                $this->assertEmpty( $post->post_name );
    702702            }
     
    707707            $posts_by_name[ $post_name ] = $post->ID;
    708708        }
    709         $this->assertEquals( array( 'waffles', 'canola', 'home', 'about', 'blog', 'custom', 'unknown-cpt' ), array_keys( $posts_by_name ) );
    710         $this->assertEquals( 'Custom', get_post( $posts_by_name['custom'] )->post_title );
    711         $this->assertEquals( 'sample-page-template.php', get_page_template_slug( $posts_by_name['about'] ) );
    712         $this->assertEquals( '', get_page_template_slug( $posts_by_name['blog'] ) );
    713         $this->assertEquals( $posts_by_name['waffles'], get_post_thumbnail_id( $posts_by_name['custom'] ) );
    714         $this->assertEquals( 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'] ) );
    715715        $attachment_metadata = wp_get_attachment_metadata( $posts_by_name['waffles'] );
    716         $this->assertEquals( 'Waffles', get_post( $posts_by_name['waffles'] )->post_title );
    717         $this->assertEquals( '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 ) );
    718718        $this->assertArrayHasKey( 'file', $attachment_metadata );
    719719        $this->assertContains( 'waffles', $attachment_metadata['file'] );
    720720
    721         $this->assertEquals( 'page', $changeset_values['show_on_front'] );
    722         $this->assertEquals( $posts_by_name['home'], $changeset_values['page_on_front'] );
    723         $this->assertEquals( $posts_by_name['blog'], $changeset_values['page_for_posts'] );
    724 
    725         $this->assertEquals( -1, $changeset_values['nav_menu_locations[top]'] );
    726         $this->assertEquals( 0, $changeset_values['nav_menu_item[-1]']['object_id'] );
    727         $this->assertEquals( 'custom', $changeset_values['nav_menu_item[-1]']['type'] );
    728         $this->assertEquals( 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'] );
    729729
    730730        $this->assertEmpty( $wp_customize->changeset_data() );
    731731        $this->assertNull( $wp_customize->changeset_post_id() );
    732         $this->assertEquals( 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' ) ) );
    733733        do_action( 'customize_register', $wp_customize ); // This will trigger the changeset save.
    734734        $this->assertInternalType( 'int', $wp_customize->changeset_post_id() );
     
    772772        );
    773773        $changeset_data = $wp_customize->changeset_data();
    774         $this->assertEquals( $previous_blogname, $changeset_data['blogname']['value'] );
     774        $this->assertSame( $previous_blogname, $changeset_data['blogname']['value'] );
    775775        $this->assertArrayNotHasKey( 'starter_content', $changeset_data['blogname'] );
    776776        $this->assertNotEquals( $previous_blogdescription, $changeset_data['blogdescription']['value'] );
     
    784784        $this->assertEmpty( get_theme_mod( 'header_image' ) );
    785785        $this->assertEmpty( get_theme_mod( 'background_image' ) );
    786         $this->assertEquals( 'auto-draft', get_post( $posts_by_name['about'] )->post_status );
    787         $this->assertEquals( '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 );
    788788        $this->assertNotEquals( $changeset_data['blogname']['value'], get_option( 'blogname' ) );
    789789        $r = $wp_customize->save_changeset_post( array( 'status' => 'publish' ) );
    790790        $this->assertInternalType( 'array', $r );
    791         $this->assertEquals( 'publish', get_post( $posts_by_name['about'] )->post_status );
    792         $this->assertEquals( 'inherit', get_post( $posts_by_name['waffles'] )->post_status );
    793         $this->assertEquals( $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' ) );
    794794        $this->assertNotEmpty( get_theme_mod( 'custom_logo' ) );
    795795        $this->assertNotEmpty( get_theme_mod( 'header_image' ) );
     
    801801        $this->assertContains( 'waffles', get_header_image() );
    802802        $this->assertContains( 'waffles', get_background_image() );
    803         $this->assertEquals( 'waffles', get_post( $posts_by_name['waffles'] )->post_name );
     803        $this->assertSame( 'waffles', get_post( $posts_by_name['waffles'] )->post_name );
    804804        $this->assertEmpty( get_post_meta( $posts_by_name['waffles'], '_customize_draft_post_name', true ) );
    805805    }
     
    892892        $wp_customize                      = new WP_Customize_Manager();
    893893        $wp_customize->customize_preview_init();
    894         $this->assertEquals( $did_action_customize_preview_init + 1, did_action( 'customize_preview_init' ) );
    895 
    896         $this->assertEquals( 10, has_action( 'wp_head', 'wp_no_robots' ) );
    897         $this->assertEquals( 10, has_action( 'wp_head', array( $wp_customize, 'remove_frameless_preview_messenger_channel' ) ) );
    898         $this->assertEquals( 10, has_filter( 'wp_headers', array( $wp_customize, 'filter_iframe_security_headers' ) ) );
    899         $this->assertEquals( 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' ) ) );
    900900        $this->assertTrue( wp_script_is( 'customize-preview', 'enqueued' ) );
    901         $this->assertEquals( 10, has_action( 'wp_head', array( $wp_customize, 'customize_preview_loading_style' ) ) );
    902         $this->assertEquals( 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' ) ) );
    903903
    904904        // Test unauthorized user outside preview (no messenger_channel).
     
    935935        $this->assertArrayHasKey( 'X-Frame-Options', $headers );
    936936        $this->assertArrayHasKey( 'Content-Security-Policy', $headers );
    937         $this->assertEquals( 'SAMEORIGIN', $headers['X-Frame-Options'] );
    938         $this->assertEquals( "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'] );
    939939    }
    940940
     
    962962        $this->assertArrayHasKey( 'customize_changeset_uuid', $query_params );
    963963        $this->assertArrayNotHasKey( 'customize_theme', $query_params );
    964         $this->assertEquals( $uuid, $query_params['customize_changeset_uuid'] );
    965         $this->assertEquals( $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'] );
    966966
    967967        $uuid         = wp_generate_uuid4();
     
    979979        $this->assertArrayHasKey( 'customize_changeset_uuid', $query_params );
    980980        $this->assertArrayHasKey( 'customize_theme', $query_params );
    981         $this->assertEquals( $uuid, $query_params['customize_changeset_uuid'] );
    982         $this->assertEquals( $preview_theme, $query_params['customize_theme'] );
     981        $this->assertSame( $uuid, $query_params['customize_changeset_uuid'] );
     982        $this->assertSame( $preview_theme, $query_params['customize_theme'] );
    983983
    984984        $uuid         = wp_generate_uuid4();
     
    10441044        $this->assertInternalType( 'array', $r );
    10451045
    1046         $this->assertEquals( $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' ) );
    10471047
    10481048        $post_id = $manager->find_changeset_post_id( $uuid );
    10491049        $this->assertNotNull( $post_id );
    10501050        $saved_data = json_decode( get_post( $post_id )->post_content, true );
    1051         $this->assertEquals( $manager->unsanitized_post_values(), wp_list_pluck( $saved_data, 'value' ) );
    1052         $this->assertEquals( $pre_saved_data['blogname']['value'], $saved_data['blogname']['value'] );
    1053         $this->assertEquals( $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'] );
    10541054        foreach ( $saved_data as $setting_id => $setting_params ) {
    10551055            $this->assertArrayHasKey( 'type', $setting_params );
    1056             $this->assertEquals( 'option', $setting_params['type'] );
     1056            $this->assertSame( 'option', $setting_params['type'] );
    10571057            $this->assertArrayHasKey( 'user_id', $setting_params );
    1058             $this->assertEquals( self::$admin_user_id, $setting_params['user_id'] );
     1058            $this->assertSame( self::$admin_user_id, $setting_params['user_id'] );
    10591059        }
    1060         $this->assertEquals( 'Auto Draft', get_post( $post_id )->post_title );
    1061         $this->assertEquals( 'auto-draft', get_post( $post_id )->post_status );
    1062         $this->assertEquals( $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 );
    10631063        $this->assertNotEquals( 'Changeset Title', get_option( 'blogname' ) );
    10641064        $this->assertArrayHasKey( 'setting_validities', $r );
     
    10981098        );
    10991099        $this->assertInstanceOf( 'WP_Error', $r );
    1100         $this->assertEquals( 'transaction_fail', $r->get_error_code() );
     1100        $this->assertSame( 'transaction_fail', $r->get_error_code() );
    11011101        $this->assertInternalType( 'array', $r->get_error_data() );
    11021102        $this->assertArrayHasKey( 'setting_validities', $r->get_error_data() );
     
    11061106        $this->assertArrayHasKey( 'foo_unauthorized', $error_data['setting_validities'] );
    11071107        $this->assertInstanceOf( 'WP_Error', $error_data['setting_validities']['foo_unauthorized'] );
    1108         $this->assertEquals( 'unauthorized', $error_data['setting_validities']['foo_unauthorized']->get_error_code() );
     1108        $this->assertSame( 'unauthorized', $error_data['setting_validities']['foo_unauthorized']->get_error_code() );
    11091109        $this->assertArrayHasKey( 'bar_unknown', $error_data['setting_validities'] );
    11101110        $this->assertInstanceOf( 'WP_Error', $error_data['setting_validities']['bar_unknown'] );
    1111         $this->assertEquals( 'unrecognized', $error_data['setting_validities']['bar_unknown']->get_error_code() );
     1111        $this->assertSame( 'unrecognized', $error_data['setting_validities']['bar_unknown']->get_error_code() );
    11121112        $this->assertArrayHasKey( 'baz_illegal', $error_data['setting_validities'] );
    11131113        $this->assertInstanceOf( 'WP_Error', $error_data['setting_validities']['baz_illegal'] );
    1114         $this->assertEquals( 'illegal', $error_data['setting_validities']['baz_illegal']->get_error_code() );
     1114        $this->assertSame( 'illegal', $error_data['setting_validities']['baz_illegal']->get_error_code() );
    11151115
    11161116        // Since transactional, ensure no changes have been made.
    1117         $this->assertEquals( $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 ) );
    11181118
    11191119        // Attempt a non-transactional/incremental update.
     
    11441144        $saved_data = json_decode( get_post( $post_id )->post_content, true );
    11451145        $this->assertNotEquals( $previous_saved_data, $saved_data );
    1146         $this->assertEquals( 'Non-Transactional \o/ <script>unsanitized</script>', $saved_data['blogname']['value'] );
     1146        $this->assertSame( 'Non-Transactional \o/ <script>unsanitized</script>', $saved_data['blogname']['value'] );
    11471147
    11481148        // Ensure the filter applies.
     
    11591159            )
    11601160        );
    1161         $this->assertEquals( $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 );
    11621162
    11631163        // Publish the changeset: actions will be doubled since also trashed.
     
    12061206        );
    12071207        $this->assertInternalType( 'array', $r );
    1208         $this->assertEquals( 'Do it live \o/', get_option( 'blogname' ) );
    1209         $this->assertEquals( 'trash', get_post_status( $post_id ) ); // Auto-trashed.
    1210         $this->assertEquals( $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' ) );
    12111211        $this->assertContains( '<script>', get_post( $post_id )->post_content );
    1212         $this->assertEquals( $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->assertEquals( '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 ) );
    12151215        $this->assertTrue( is_numeric( get_post_meta( $post_id, '_wp_trash_meta_time', true ) ) );
    12161216
    12171217        foreach ( array_keys( $expected_actions ) as $action_name ) {
    1218             $this->assertEquals( $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" );
    12191219        }
    12201220
     
    12941294        $autosave_revision = wp_get_post_autosave( $wp_customize->changeset_post_id(), get_current_user_id() );
    12951295        $saved_data        = json_decode( $autosave_revision->post_content, true );
    1296         $this->assertEquals( $options['custom_html_1'], $saved_data['custom_html_1']['value'] );
    1297         $this->assertEquals( $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'] );
    12981298
    12991299        // Update post to discard autosave.
     
    13101310        $wp_customize = $this->get_manager_for_testing_json_corruption_protection( $uuid );
    13111311        $saved_data   = json_decode( get_post( $wp_customize->changeset_post_id() )->post_content, true );
    1312         $this->assertEquals( $options['custom_html_1'], $saved_data['custom_html_1']['value'] );
    1313         $this->assertEquals( $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'] );
    13141314
    13151315        /*
     
    13201320        $revision   = array_shift( $revisions );
    13211321        $saved_data = json_decode( $revision->post_content, true );
    1322         $this->assertEquals( $options['custom_html_1'], $saved_data['custom_html_1']['value'] );
    1323         $this->assertEquals( $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'] );
    13241324
    13251325        /*
     
    14771477        $manager->save_changeset_post( array( 'status' => 'publish' ) ); // Activate.
    14781478
    1479         $this->assertEquals( '#123456', $post_values['background_color'] );
    1480         $this->assertEquals( $preview_theme, get_stylesheet() );
    1481         $this->assertEquals( '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' ) );
    14821482    }
    14831483
     
    15141514        );
    15151515        $this->assertInternalType( 'array', $r );
    1516         $this->assertEquals(
     1516        $this->assertSame(
    15171517            array_fill_keys( array( 'blogname', 'scratchpad', 'background_color' ), true ),
    15181518            $r['setting_validities']
     
    15201520        $post_id = $wp_customize->find_changeset_post_id( $uuid );
    15211521        $data    = json_decode( get_post( $post_id )->post_content, true );
    1522         $this->assertEquals( self::$admin_user_id, $data['blogname']['user_id'] );
    1523         $this->assertEquals( self::$admin_user_id, $data['scratchpad']['user_id'] );
    1524         $this->assertEquals( 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'] );
    15251525
    15261526        // Attempt to save just one setting under a different user.
     
    15411541        );
    15421542        $this->assertInternalType( 'array', $r );
    1543         $this->assertEquals(
     1543        $this->assertSame(
    15441544            array_fill_keys( array( 'blogname', 'background_color' ), true ),
    15451545            $r['setting_validities']
    15461546        );
    15471547        $data = json_decode( get_post( $post_id )->post_content, true );
    1548         $this->assertEquals( 'Admin 2 Title', $data['blogname']['value'] );
    1549         $this->assertEquals( $other_admin_user_id, $data['blogname']['user_id'] );
    1550         $this->assertEquals( 'Admin 1 Scratch', $data['scratchpad']['value'] );
    1551         $this->assertEquals( self::$admin_user_id, $data['scratchpad']['user_id'] );
    1552         $this->assertEquals( '#FFFFFF', $data[ $this->manager->get_stylesheet() . '::background_color' ]['value'] );
    1553         $this->assertEquals( $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'] );
    15541554
    15551555        // Attempt to save now as under-privileged user.
     
    15701570        );
    15711571        $this->assertInternalType( 'array', $r );
    1572         $this->assertEquals(
    1573             array_fill_keys( array( 'scratchpad', 'blogname' ), true ),
     1572        $this->assertSame(
     1573            array_fill_keys( array( 'blogname', 'scratchpad' ), true ),
    15741574            $r['setting_validities']
    15751575        );
    15761576        $data = json_decode( get_post( $post_id )->post_content, true );
    1577         $this->assertEquals( $other_admin_user_id, $data['blogname']['user_id'], 'Expected setting to be untouched.' );
    1578         $this->assertEquals( self::$subscriber_user_id, $data['scratchpad']['user_id'] );
    1579         $this->assertEquals( $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'] );
    15801580
    15811581        // Manually update the changeset so that the user_id context is not included.
     
    16101610        foreach ( array_keys( $data ) as $setting_id ) {
    16111611            $setting_id = preg_replace( '/^.+::/', '', $setting_id );
    1612             $this->assertEquals( $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 );
    16131613        }
    16141614        $this->assertEqualSets( array( 'blogname', 'blogdescription', 'background_color', 'scratchpad' ), array_keys( $this->filtered_setting_current_user_ids ) );
    1615         $this->assertEquals( $other_admin_user_id, $this->filtered_setting_current_user_ids['blogname'] );
    1616         $this->assertEquals( 0, $this->filtered_setting_current_user_ids['blogdescription'] );
    1617         $this->assertEquals( self::$subscriber_user_id, $this->filtered_setting_current_user_ids['scratchpad'] );
    1618         $this->assertEquals( $other_admin_user_id, $this->filtered_setting_current_user_ids['background_color'] );
    1619         $this->assertEquals( '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' ) );
    16201620    }
    16211621
     
    17471747        );
    17481748        $this->assertInstanceOf( 'WP_Error', $r['setting_validities']['unknownsetting'] );
    1749         $this->assertEquals( 'unrecognized', $r['setting_validities']['unknownsetting']->get_error_code() );
     1749        $this->assertSame( 'unrecognized', $r['setting_validities']['unknownsetting']->get_error_code() );
    17501750        $this->assertInstanceOf( 'WP_Error', $r['setting_validities']['blogterminated'] );
    1751         $this->assertEquals( 'unauthorized', $r['setting_validities']['blogterminated']->get_error_code() );
    1752         $this->assertEquals( $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 );
    17531753
    17541754        // Test submitting data with changed and unchanged settings, creating a new instance so that the post_values are cleared.
     
    17771777
    17781778        // Note that blogfounded is not included among setting_validities because no value was supplied and it is not unrecognized/unauthorized.
    1779         $this->assertEquals( 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.' );
    17801780
    17811781        $data = json_decode( get_post( $wp_customize->changeset_post_id() )->post_content, true );
    17821782
    1783         $this->assertEquals( self::$admin_user_id, $data['blogname']['user_id'], 'Expected unchanged user_id since value was unchanged.' );
    1784         $this->assertEquals( $other_admin_user_id, $data['blogdescription']['user_id'] );
    1785         $this->assertEquals( $other_admin_user_id, $data['blogfounded']['user_id'] );
    1786         $this->assertEquals( $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'] );
    17871787    }
    17881788
     
    18561856        );
    18571857        $this->assertInstanceOf( 'WP_Error', $r );
    1858         $this->assertEquals( 'illegal_autosave_with_date_gmt', $r->get_error_code() );
     1858        $this->assertSame( 'illegal_autosave_with_date_gmt', $r->get_error_code() );
    18591859
    18601860        // Fail: illegal_autosave_with_status.
     
    18651865            )
    18661866        );
    1867         $this->assertEquals( 'illegal_autosave_with_status', $r->get_error_code() );
     1867        $this->assertSame( 'illegal_autosave_with_status', $r->get_error_code() );
    18681868
    18691869        // Fail: illegal_autosave_with_non_current_user.
     
    18741874            )
    18751875        );
    1876         $this->assertEquals( 'illegal_autosave_with_non_current_user', $r->get_error_code() );
     1876        $this->assertSame( 'illegal_autosave_with_non_current_user', $r->get_error_code() );
    18771877
    18781878        // Try autosave.
     
    19611961        do_action( 'customize_register', $wp_customize );
    19621962        $wp_customize->save_changeset_post( array( 'status' => 'publish' ) );
    1963         $this->assertEquals( 'Unfiltered<script>evil</script>', get_option( 'scratchpad' ) );
     1963        $this->assertSame( 'Unfiltered<script>evil</script>', get_option( 'scratchpad' ) );
    19641964
    19651965        // Attempt scratchpad with user who doesn't have unfiltered_html.
     
    19771977        do_action( 'customize_register', $wp_customize );
    19781978        $wp_customize->save_changeset_post( array( 'status' => 'publish' ) );
    1979         $this->assertEquals( 'Unfilteredevil', get_option( 'scratchpad' ) );
     1979        $this->assertSame( 'Unfilteredevil', get_option( 'scratchpad' ) );
    19801980
    19811981        // Attempt publishing scratchpad as anonymous user when changeset was set by privileged user.
     
    19941994        $wp_customize = null;
    19951995        unset( $GLOBALS['wp_actions']['customize_register'] );
    1996         $this->assertEquals( 'Unfilteredevil', apply_filters( 'content_save_pre', 'Unfiltered<script>evil</script>' ) );
     1996        $this->assertSame( 'Unfilteredevil', apply_filters( 'content_save_pre', 'Unfiltered<script>evil</script>' ) );
    19971997        wp_publish_post( $changeset_post_id ); // @todo If wp_update_post() is used here, then kses will corrupt the post_content.
    1998         $this->assertEquals( 'Unfiltered<script>evil</script>', get_option( 'scratchpad' ) );
     1998        $this->assertSame( 'Unfiltered<script>evil</script>', get_option( 'scratchpad' ) );
    19991999    }
    20002000
     
    20482048        // Ensure that the value has actually been written to the DB.
    20492049        $updated_sidebars_widgets = get_option( 'sidebars_widgets' );
    2050         $this->assertEquals( $new_sidebar_1, $updated_sidebars_widgets['sidebar-1'] );
     2050        $this->assertSame( $new_sidebar_1, $updated_sidebars_widgets['sidebar-1'] );
    20512051    }
    20522052
     
    21002100        $r = $manager->save_changeset_post( $args );
    21012101        $this->assertInstanceOf( 'WP_Error', $r );
    2102         $this->assertEquals( 'json_parse_error', $r->get_error_code() );
     2102        $this->assertSame( 'json_parse_error', $r->get_error_code() );
    21032103
    21042104        wp_update_post(
     
    21102110        $r = $manager->save_changeset_post( $args );
    21112111        $this->assertInstanceOf( 'WP_Error', $r );
    2112         $this->assertEquals( 'expected_array', $r->get_error_code() );
     2112        $this->assertSame( 'expected_array', $r->get_error_code() );
    21132113    }
    21142114
     
    22182218        $this->assertFalse( $wp_customize->is_cross_domain() );
    22192219        $allowed = $wp_customize->get_allowed_urls();
    2220         $this->assertEquals( $allowed, array( home_url( '/', 'http' ) ) );
     2220        $this->assertSame( $allowed, array( home_url( '/', 'http' ) ) );
    22212221
    22222222        add_filter( 'customize_allowed_urls', array( $this, 'filter_customize_allowed_urls' ) );
     
    22772277        $_POST['customized'] = wp_slash( wp_json_encode( $customized ) );
    22782278        $post_values         = $manager->unsanitized_post_values();
    2279         $this->assertEquals( $customized, $post_values );
     2279        $this->assertSame( $customized, $post_values );
    22802280        $this->assertEmpty( $manager->unsanitized_post_values( array( 'exclude_post_data' => true ) ) );
    22812281
    22822282        $manager->set_post_value( 'foo', 'BAR' );
    22832283        $post_values = $manager->unsanitized_post_values();
    2284         $this->assertEquals( 'BAR', $post_values['foo'] );
     2284        $this->assertSame( 'BAR', $post_values['foo'] );
    22852285        $this->assertEmpty( $manager->unsanitized_post_values( array( 'exclude_post_data' => true ) ) );
    22862286
     
    23462346        $this->assertArrayNotHasKey( 'background_color', $manager->unsanitized_post_values() );
    23472347
    2348         $this->assertEquals(
     2348        $this->assertSame(
    23492349            array(
    23502350                'blogname'        => 'Changeset Title',
     
    23532353            $manager->unsanitized_post_values()
    23542354        );
    2355         $this->assertEquals(
     2355        $this->assertSame(
    23562356            array(
    23572357                'blogdescription' => 'Post Input Tagline',
     
    23612361
    23622362        $manager->set_post_value( 'blogdescription', 'Post Override Tagline' );
    2363         $this->assertEquals(
     2363        $this->assertSame(
    23642364            array(
    23652365                'blogname'        => 'Changeset Title',
     
    23692369        );
    23702370
    2371         $this->assertEquals(
     2371        $this->assertSame(
    23722372            array(
    23732373                'blogname'        => 'Changeset Title',
     
    24022402        $this->assertNotEmpty( $values );
    24032403        $this->assertArrayHasKey( 'background_color', $values );
    2404         $this->assertEquals( '#000000', $values['background_color'] );
     2404        $this->assertSame( '#000000', $values['background_color'] );
    24052405
    24062406        $values = $manager->unsanitized_post_values(
     
    24312431        $manager->add_setting( 'foo', array( 'default' => 'foo_default' ) );
    24322432        $foo_setting = $manager->get_setting( 'foo' );
    2433         $this->assertEquals( 'foo_default', $manager->get_setting( 'foo' )->value(), 'Expected non-previewed setting to return default when value() method called.' );
    2434         $this->assertEquals( $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]' );
    24352435
    24362436        $manager->add_setting( 'bar', array( 'default' => 'bar_default' ) );
    24372437        $bar_setting = $manager->get_setting( 'bar' );
    2438         $this->assertEquals( '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]' );
    24392439    }
    24402440
     
    24542454            )
    24552455        );
    2456         $this->assertEquals( $default_value, $this->manager->post_value( $setting, $default_value ) );
    2457         $this->assertEquals( $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 ) );
    24582458
    24592459        $post_value = 'bar';
    24602460        $this->manager->set_post_value( 'foo', $post_value );
    2461         $this->assertEquals( strtoupper( $post_value ), $this->manager->post_value( $setting, $default_value ) );
    2462         $this->assertEquals( 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 ) );
    24632463
    24642464        $this->manager->set_post_value( 'foo', 'return_wp_error_in_sanitize' );
    2465         $this->assertEquals( $default_value, $this->manager->post_value( $setting, $default_value ) );
    2466         $this->assertEquals( $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 ) );
    24672467
    24682468        $this->manager->set_post_value( 'foo', 'return_null_in_sanitize' );
    2469         $this->assertEquals( $default_value, $this->manager->post_value( $setting, $default_value ) );
    2470         $this->assertEquals( $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 ) );
    24712471
    24722472        $post_value = '<script>evil</script>';
    24732473        $this->manager->set_post_value( 'foo', $post_value );
    2474         $this->assertEquals( $default_value, $this->manager->post_value( $setting, $default_value ) );
    2475         $this->assertEquals( $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 ) );
    24762476    }
    24772477
     
    25232523            )
    25242524        );
    2525         $this->assertEquals( $default_value, $this->manager->post_value( $setting, $default_value ) );
    2526         $this->assertEquals( $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 ) );
    25272527
    25282528        $post_value = '42';
     
    25752575        $validities = $this->manager->validate_setting_values( $this->manager->unsanitized_post_values() );
    25762576        $this->assertCount( 1, $validities );
    2577         $this->assertEquals( array( 'foo' => true ), $validities );
     2577        $this->assertSame( array( 'foo' => true ), $validities );
    25782578
    25792579        $this->manager->set_post_value( 'foo', 'return_wp_error_in_sanitize' );
     
    25832583        $this->assertInstanceOf( 'WP_Error', $invalid_settings[ $setting->id ] );
    25842584        $error = $invalid_settings[ $setting->id ];
    2585         $this->assertEquals( 'invalid_value_in_sanitize', $error->get_error_code() );
    2586         $this->assertEquals( 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() );
    25872587
    25882588        $this->manager->set_post_value( 'foo', 'return_null_in_sanitize' );
     
    26002600        $this->assertInstanceOf( 'WP_Error', $invalid_settings[ $setting->id ] );
    26012601        $error = $invalid_settings[ $setting->id ];
    2602         $this->assertEquals( 'invalid_value_in_validate', $error->get_error_code() );
    2603         $this->assertEquals( 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() );
    26042604    }
    26052605
     
    26272627        $validity           = $setting_validities[ $setting->id ];
    26282628        $this->assertInstanceOf( 'WP_Error', $validity );
    2629         $this->assertEquals( 'minlength', $validity->get_error_code() );
     2629        $this->assertSame( 'minlength', $validity->get_error_code() );
    26302630    }
    26312631
     
    26512651        $error = $validities['unknown'];
    26522652        $this->assertInstanceOf( 'WP_Error', $error );
    2653         $this->assertEquals( 'unrecognized', $error->get_error_code() );
     2653        $this->assertSame( 'unrecognized', $error->get_error_code() );
    26542654
    26552655        $this->manager->get_setting( 'blogname' )->capability = 'do_not_allow';
     
    26612661        $error = $validities['blogname'];
    26622662        $this->assertInstanceOf( 'WP_Error', $error );
    2663         $this->assertEquals( 'unauthorized', $error->get_error_code() );
     2663        $this->assertSame( 'unauthorized', $error->get_error_code() );
    26642664    }
    26652665
     
    27002700        $validities = $this->manager->validate_setting_values( $this->manager->unsanitized_post_values() );
    27012701        $this->assertCount( 1, $validities );
    2702         $this->assertEquals( array( 'numeric' => true ), $validities );
     2702        $this->assertSame( array( 'numeric' => true ), $validities );
    27032703    }
    27042704
     
    27192719            $this->assertArrayHasKey( $code, $validity );
    27202720            $this->assertInternalType( 'array', $validity[ $code ] );
    2721             $this->assertEquals( join( ' ', $messages ), $validity[ $code ]['message'] );
     2721            $this->assertSame( join( ' ', $messages ), $validity[ $code ]['message'] );
    27222722            $this->assertArrayHasKey( 'data', $validity[ $code ] );
    2723             $this->assertEquals( $validity[ $code ]['data'], $error->get_error_data( $code ) );
     2723            $this->assertSame( $validity[ $code ]['data'], $error->get_error_data( $code ) );
    27242724        }
    27252725        $this->assertArrayHasKey( 'number', $validity['bad_number']['data'] );
    2726         $this->assertEquals( 123, $validity['bad_number']['data']['number'] );
     2726        $this->assertSame( 123, $validity['bad_number']['data']['number'] );
    27272727    }
    27282728
     
    27472747        $this->manager->set_post_value( $setting->id, '123abc' );
    27482748        $this->assertCount( 2, $this->captured_customize_post_value_set_actions );
    2749         $this->assertEquals( 'customize_post_value_set_foo', $this->captured_customize_post_value_set_actions[0]['action'] );
    2750         $this->assertEquals( 'customize_post_value_set', $this->captured_customize_post_value_set_actions[1]['action'] );
    2751         $this->assertEquals( array( '123abc', $this->manager ), $this->captured_customize_post_value_set_actions[0]['args'] );
    2752         $this->assertEquals( 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'] );
    27532753
    27542754        $unsanitized = $this->manager->unsanitized_post_values();
    27552755        $this->assertArrayHasKey( $setting->id, $unsanitized );
    27562756
    2757         $this->assertEquals( '123abc', $unsanitized[ $setting->id ] );
    2758         $this->assertEquals( 123, $setting->post_value() );
     2757        $this->assertSame( '123abc', $unsanitized[ $setting->id ] );
     2758        $this->assertSame( 123, $setting->post_value() );
    27592759    }
    27602760
     
    28072807        $manager->add_dynamic_settings( $setting_ids );
    28082808        $this->assertNotEmpty( $manager->get_setting( 'bar' ), 'Expected bar setting to be created since filters were added.' );
    2809         $this->assertEquals( 'foo_default', $manager->get_setting( 'foo' )->default, 'Expected static foo setting to not get overridden by dynamic setting.' );
    2810         $this->assertEquals( '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.' );
    28112811    }
    28122812
     
    29262926     */
    29272927    function filter_customize_dynamic_setting_class_for_test_dynamic_settings( $setting_class, $setting_id, $setting_args ) {
    2928         $this->assertEquals( 'WP_Customize_Setting', $setting_class );
     2928        $this->assertSame( 'WP_Customize_Setting', $setting_class );
    29292929        $this->assertInternalType( 'string', $setting_id );
    29302930        $this->assertInternalType( 'array', $setting_args );
     
    29492949     */
    29502950    function test_preview_url() {
    2951         $this->assertEquals( home_url( '/' ), $this->manager->get_preview_url() );
     2951        $this->assertSame( home_url( '/' ), $this->manager->get_preview_url() );
    29522952        $preview_url = home_url( '/foo/bar/baz/' );
    29532953        $this->manager->set_preview_url( $preview_url );
    2954         $this->assertEquals( $preview_url, $this->manager->get_preview_url() );
     2954        $this->assertSame( $preview_url, $this->manager->get_preview_url() );
    29552955        $this->manager->set_preview_url( 'http://illegalsite.example.com/food/' );
    2956         $this->assertEquals( home_url( '/' ), $this->manager->get_preview_url() );
     2956        $this->assertSame( home_url( '/' ), $this->manager->get_preview_url() );
    29572957    }
    29582958
     
    29652965    function test_return_url() {
    29662966        wp_set_current_user( self::factory()->user->create( array( 'role' => 'author' ) ) );
    2967         $this->assertEquals( home_url( '/' ), $this->manager->get_return_url() );
     2967        $this->assertSame( home_url( '/' ), $this->manager->get_return_url() );
    29682968
    29692969        wp_set_current_user( self::$admin_user_id );
    29702970        $this->assertTrue( current_user_can( 'edit_theme_options' ) );
    2971         $this->assertEquals( home_url( '/' ), $this->manager->get_return_url() );
     2971        $this->assertSame( home_url( '/' ), $this->manager->get_return_url() );
    29722972
    29732973        $preview_url = home_url( '/foo/' );
    29742974        $this->manager->set_preview_url( $preview_url );
    2975         $this->assertEquals( $preview_url, $this->manager->get_return_url() );
     2975        $this->assertSame( $preview_url, $this->manager->get_return_url() );
    29762976
    29772977        $_SERVER['HTTP_REFERER'] = wp_slash( admin_url( 'customize.php' ) );
    2978         $this->assertEquals( $preview_url, $this->manager->get_return_url() );
     2978        $this->assertSame( $preview_url, $this->manager->get_return_url() );
    29792979
    29802980        // See #35355.
    29812981        $_SERVER['HTTP_REFERER'] = wp_slash( admin_url( 'wp-login.php' ) );
    2982         $this->assertEquals( $preview_url, $this->manager->get_return_url() );
     2982        $this->assertSame( $preview_url, $this->manager->get_return_url() );
    29832983
    29842984        $url                     = home_url( '/referred/' );
    29852985        $_SERVER['HTTP_REFERER'] = wp_slash( $url );
    2986         $this->assertEquals( $url, $this->manager->get_return_url() );
     2986        $this->assertSame( $url, $this->manager->get_return_url() );
    29872987
    29882988        $url                     = 'http://badreferer.example.com/';
    29892989        $_SERVER['HTTP_REFERER'] = wp_slash( $url );
    29902990        $this->assertNotEquals( $url, $this->manager->get_return_url() );
    2991         $this->assertEquals( $preview_url, $this->manager->get_return_url() );
     2991        $this->assertSame( $preview_url, $this->manager->get_return_url() );
    29922992
    29932993        $this->manager->set_return_url( admin_url( 'edit.php?trashed=1' ) );
    2994         $this->assertEquals( admin_url( 'edit.php' ), $this->manager->get_return_url() );
     2994        $this->assertSame( admin_url( 'edit.php' ), $this->manager->get_return_url() );
    29952995    }
    29962996
     
    30003000    function test_return_url_with_deactivated_theme() {
    30013001        $this->manager->set_return_url( admin_url( 'themes.php?page=mytheme_documentation' ) );
    3002         $this->assertEquals( admin_url( 'themes.php' ), $this->manager->get_return_url() );
     3002        $this->assertSame( admin_url( 'themes.php' ), $this->manager->get_return_url() );
    30033003    }
    30043004
     
    30173017        $autofocus = array( 'control' => 'blogname' );
    30183018        $this->manager->set_autofocus( $autofocus );
    3019         $this->assertEquals( $autofocus, $this->manager->get_autofocus() );
     3019        $this->assertSame( $autofocus, $this->manager->get_autofocus() );
    30203020
    30213021        $autofocus = array( 'section' => 'colors' );
    30223022        $this->manager->set_autofocus( $autofocus );
    3023         $this->assertEquals( $autofocus, $this->manager->get_autofocus() );
     3023        $this->assertSame( $autofocus, $this->manager->get_autofocus() );
    30243024
    30253025        $autofocus = array( 'panel' => 'widgets' );
    30263026        $this->manager->set_autofocus( $autofocus );
    3027         $this->assertEquals( $autofocus, $this->manager->get_autofocus() );
     3027        $this->assertSame( $autofocus, $this->manager->get_autofocus() );
    30283028
    30293029        $autofocus = array( 'control' => array( 'blogname', 'blogdescription' ) );
     
    30463046        $nonces = $this->manager->get_nonces();
    30473047        $this->assertArrayHasKey( 'foo', $nonces );
    3048         $this->assertEquals( wp_create_nonce( 'foo' ), $nonces['foo'] );
     3048        $this->assertSame( wp_create_nonce( 'foo' ), $nonces['foo'] );
    30493049    }
    30503050
     
    30913091
    30923092        $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->assertEquals( $autofocus, $data['autofocus'] );
     3093        $this->assertSame( $autofocus, $data['autofocus'] );
    30943094        $this->assertArrayHasKey( 'save', $data['nonce'] );
    30953095        $this->assertArrayHasKey( 'preview', $data['nonce'] );
     
    31493149        $content = ob_get_clean();
    31503150
    3151         $this->assertEquals( 1, preg_match( '/var _wpCustomizeSettings = ({.+});/', $content, $matches ) );
     3151        $this->assertSame( 1, preg_match( '/var _wpCustomizeSettings = ({.+});/', $content, $matches ) );
    31523152        $settings = json_decode( $matches[1], true );
    31533153
     
    32663266
    32673267        $sorted_control_ids = wp_list_pluck( $manager->get_section( $section_id )->controls, 'id' );
    3268         $this->assertEquals( $added_control_ids, $sorted_control_ids );
     3268        $this->assertSame( $added_control_ids, $sorted_control_ids );
    32693269    }
    32703270
     
    32863286
    32873287        $this->assertInstanceOf( 'WP_Customize_Section', $result_section );
    3288         $this->assertEquals( $section_id, $result_section->id );
     3288        $this->assertSame( $section_id, $result_section->id );
    32893289
    32903290        $section        = new WP_Customize_Section(
     
    32993299
    33003300        $this->assertInstanceOf( 'WP_Customize_Section', $result_section );
    3301         $this->assertEquals( $section_id, $result_section->id );
    3302         $this->assertEquals( $section, $result_section );
     3301        $this->assertSame( $section_id, $result_section->id );
     3302        $this->assertSame( $section, $result_section );
    33033303    }
    33043304
     
    33143314
    33153315        $this->assertInstanceOf( 'WP_Customize_Setting', $result_setting );
    3316         $this->assertEquals( $setting_id, $result_setting->id );
     3316        $this->assertSame( $setting_id, $result_setting->id );
    33173317
    33183318        $setting        = new WP_Customize_Setting( $manager, $setting_id );
     
    33203320
    33213321        $this->assertInstanceOf( 'WP_Customize_Setting', $result_setting );
    3322         $this->assertEquals( $setting, $result_setting );
    3323         $this->assertEquals( $setting_id, $result_setting->id );
     3322        $this->assertSame( $setting, $result_setting );
     3323        $this->assertSame( $setting_id, $result_setting->id );
    33243324    }
    33253325
     
    33323332        $setting_id = 'dynamic';
    33333333        $setting    = $manager->add_setting( $setting_id );
    3334         $this->assertEquals( 'WP_Customize_Setting', get_class( $setting ) );
     3334        $this->assertSame( 'WP_Customize_Setting', get_class( $setting ) );
    33353335        $this->assertObjectNotHasAttribute( 'custom', $setting );
    33363336        $manager->remove_setting( $setting_id );
     
    33393339        add_filter( 'customize_dynamic_setting_args', array( $this, 'return_dynamic_customize_setting_args' ), 10, 2 );
    33403340        $setting = $manager->add_setting( $setting_id );
    3341         $this->assertEquals( 'Test_Dynamic_Customize_Setting', get_class( $setting ) );
     3341        $this->assertSame( 'Test_Dynamic_Customize_Setting', get_class( $setting ) );
    33423342        $this->assertObjectHasAttribute( 'custom', $setting );
    3343         $this->assertEquals( 'foo', $setting->custom );
     3343        $this->assertSame( 'foo', $setting->custom );
    33443344    }
    33453345
     
    33913391
    33923392        $this->assertInstanceOf( 'WP_Customize_Panel', $result_panel );
    3393         $this->assertEquals( $panel_id, $result_panel->id );
     3393        $this->assertSame( $panel_id, $result_panel->id );
    33943394
    33953395        $panel        = new WP_Customize_Panel(
     
    34033403
    34043404        $this->assertInstanceOf( 'WP_Customize_Panel', $result_panel );
    3405         $this->assertEquals( $panel, $result_panel );
    3406         $this->assertEquals( $panel_id, $result_panel->id );
     3405        $this->assertSame( $panel, $result_panel );
     3406        $this->assertSame( $panel_id, $result_panel->id );
    34073407    }
    34083408
     
    34343434        );
    34353435        $this->assertInstanceOf( 'WP_Customize_Control', $result_control );
    3436         $this->assertEquals( $control_id, $result_control->id );
     3436        $this->assertSame( $control_id, $result_control->id );
    34373437
    34383438        $control        = new WP_Customize_Control(
     
    34483448
    34493449        $this->assertInstanceOf( 'WP_Customize_Control', $result_control );
    3450         $this->assertEquals( $control, $result_control );
    3451         $this->assertEquals( $control_id, $result_control->id );
     3450        $this->assertSame( $control, $result_control );
     3451        $this->assertSame( $control_id, $result_control->id );
    34523452    }
    34533453
     
    35453545
    35463546        $result = $this->manager->controls();
    3547         $this->assertEquals( $controls_sorted, array_keys( $result ) );
     3547        $this->assertSame( $controls_sorted, array_keys( $result ) );
    35483548    }
    35493549
     
    35743574
    35753575        $result = $this->manager->sections();
    3576         $this->assertEquals( $sections_sorted, array_keys( $result ) );
     3576        $this->assertSame( $sections_sorted, array_keys( $result ) );
    35773577    }
    35783578
     
    36033603
    36043604        $result = $this->manager->panels();
    3605         $this->assertEquals( $panels_sorted, array_keys( $result ) );
     3605        $this->assertSame( $panels_sorted, array_keys( $result ) );
    36063606    }
    36073607
     
    36273627        foreach ( $whitespaces as $whitespace ) {
    36283628            $sanitized = $setting->sanitize( $whitespace . $video_url . $whitespace );
    3629             $this->assertEquals( $video_url, $sanitized );
     3629            $this->assertSame( $video_url, $sanitized );
    36303630        }
    36313631    }
Note: See TracChangeset for help on using the changeset viewer.