Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (4 years 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/Zeroise.php

    r46586 r48937  
    66class Tests_Formatting_Zeroise extends WP_UnitTestCase {
    77    function test_pads_with_leading_zeroes() {
    8         $this->assertEquals( '00005', zeroise( 5, 5 ) );
     8        $this->assertSame( '00005', zeroise( 5, 5 ) );
    99    }
    1010
    1111    function test_does_nothing_if_input_is_already_longer() {
    12         $this->assertEquals( '5000000', zeroise( 5000000, 2 ) );
     12        $this->assertSame( '5000000', zeroise( 5000000, 2 ) );
    1313    }
    1414}
Note: See TracChangeset for help on using the changeset viewer.