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/formatting/BlogInfo.php

    r47122 r48937  
    1616
    1717        $locale = $test_locale;
    18         $this->assertEquals( $expected, get_bloginfo( 'language' ) );
     18        $this->assertSame( $expected, get_bloginfo( 'language' ) );
    1919
    2020        $locale = $old_locale;
     
    5555            update_option( 'blogname', $sanitized_value );
    5656
    57             $this->assertEquals( $expected, $sanitized_value );
    58             $this->assertEquals( $expected, get_bloginfo( 'name' ) );
    59             $this->assertEquals( $expected, get_bloginfo( 'name', 'display' ) );
     57            $this->assertSame( $expected, $sanitized_value );
     58            $this->assertSame( $expected, get_bloginfo( 'name' ) );
     59            $this->assertSame( $expected, get_bloginfo( 'name', 'display' ) );
    6060
    6161            $sanitized_value = sanitize_option( 'blogdescription', $value );
    6262            update_option( 'blogdescription', $sanitized_value );
    6363
    64             $this->assertEquals( $expected, $sanitized_value );
    65             $this->assertEquals( $expected, get_bloginfo( 'description' ) );
    66             $this->assertEquals( $expected, get_bloginfo( 'description', 'display' ) );
     64            $this->assertSame( $expected, $sanitized_value );
     65            $this->assertSame( $expected, get_bloginfo( 'description' ) );
     66            $this->assertSame( $expected, get_bloginfo( 'description', 'display' ) );
    6767        }
    6868
Note: See TracChangeset for help on using the changeset viewer.