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/functions/getWeekstartend.php

    r46586 r48937  
    1212        );
    1313
    14         $this->assertEquals( $expected, get_weekstartend( '2016-02-12' ) );
     14        $this->assertSame( $expected, get_weekstartend( '2016-02-12' ) );
    1515    }
    1616
     
    2121        );
    2222
    23         $this->assertEquals( $expected, get_weekstartend( '2016-02-12', 0 ) );
     23        $this->assertSame( $expected, get_weekstartend( '2016-02-12', 0 ) );
    2424    }
    2525
     
    3232        );
    3333
    34         $this->assertEquals( $expected, get_weekstartend( '2016-02-12' ) );
     34        $this->assertSame( $expected, get_weekstartend( '2016-02-12' ) );
    3535    }
    3636
     
    4343        );
    4444
    45         $this->assertEquals( $expected, get_weekstartend( '2016-02-12' ) );
     45        $this->assertSame( $expected, get_weekstartend( '2016-02-12' ) );
    4646    }
    4747}
Note: See TracChangeset for help on using the changeset viewer.