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/date/wpTimezone.php

    r46586 r48937  
    1919        update_option( 'gmt_offset', $gmt_offset );
    2020
    21         $this->assertEquals( $tz_name, wp_timezone_string() );
     21        $this->assertSame( $tz_name, wp_timezone_string() );
    2222
    2323        $timezone = wp_timezone();
    2424
    25         $this->assertEquals( $tz_name, $timezone->getName() );
     25        $this->assertSame( $tz_name, $timezone->getName() );
    2626    }
    2727
     
    3232        update_option( 'timezone_string', 'Europe/Kiev' );
    3333
    34         $this->assertEquals( 'Europe/Kiev', wp_timezone_string() );
     34        $this->assertSame( 'Europe/Kiev', wp_timezone_string() );
    3535
    3636        $timezone = wp_timezone();
    3737
    38         $this->assertEquals( 'Europe/Kiev', $timezone->getName() );
     38        $this->assertSame( 'Europe/Kiev', $timezone->getName() );
    3939    }
    4040
Note: See TracChangeset for help on using the changeset viewer.