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

    r47122 r48937  
    111111        );
    112112
    113         $this->assertEquals( $expected, $q->queries );
     113        $this->assertSame( $expected, $q->queries );
    114114    }
    115115
     
    10791079        );
    10801080
    1081         $this->assertEquals( array( $p2 ), $q->posts );
     1081        $this->assertSame( array( $p2 ), $q->posts );
    10821082    }
    10831083
     
    11011101        );
    11021102
    1103         $this->assertEquals( array( $p2 ), $q->posts );
     1103        $this->assertSame( array( $p2 ), $q->posts );
    11041104    }
    11051105
     
    11251125
    11261126        // MySQL ignores the invalid clause.
    1127         $this->assertEquals( array( $p1, $p2 ), $q->posts );
     1127        $this->assertSame( array( $p1, $p2 ), $q->posts );
    11281128    }
    11291129
Note: See TracChangeset for help on using the changeset viewer.