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/getPermalink.php

    r47118 r48937  
    3434        );
    3535
    36         $this->assertEquals( 'http://example.org/2018/07/22/21/13/23', get_permalink( $post_id ) );
     36        $this->assertSame( 'http://example.org/2018/07/22/21/13/23', get_permalink( $post_id ) );
    3737
    3838        // phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
    3939        date_default_timezone_set( $timezone );
    40         $this->assertEquals( 'http://example.org/2018/07/22/21/13/23', get_permalink( $post_id ) );
     40        $this->assertSame( 'http://example.org/2018/07/22/21/13/23', get_permalink( $post_id ) );
    4141    }
    4242}
Note: See TracChangeset for help on using the changeset viewer.