Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (5 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/date/xmlrpc.php

    r46864 r48937  
    3535        );
    3636
    37         $this->assertEquals(
     37        $this->assertSame(
    3838            $datetime->format( 'Y-m-d H:i:s' ),
    3939            $post->post_date,
     
    5656        );
    5757
    58         $this->assertEquals(
     58        $this->assertSame(
    5959            $datetime->format( 'Y-m-d H:i:s' ),
    6060            $post->post_date,
     
    7777        );
    7878
    79         $this->assertEquals(
     79        $this->assertSame(
    8080            $datetime->format( 'Y-m-d H:i:s' ),
    8181            $post->post_date,
     
    9898        );
    9999
    100         $this->assertEquals(
     100        $this->assertSame(
    101101            $datetime->format( 'Y-m-d H:i:s' ),
    102102            $post->post_date,
     
    119119        );
    120120
    121         $this->assertEquals(
     121        $this->assertSame(
    122122            $datetime->format( 'Y-m-d H:i:s' ),
    123123            $post->post_date,
     
    159159
    160160        $this->assertTrue( $result );
    161         $this->assertEquals(
     161        $this->assertSame(
    162162            $datetime->format( 'Y-m-d H:i:s' ),
    163163            $fetched_post->post_date,
     
    186186
    187187        $this->assertTrue( $result );
    188         $this->assertEquals(
     188        $this->assertSame(
    189189            $datetime->format( 'Y-m-d H:i:s' ),
    190190            $fetched_post->post_date,
     
    232232
    233233        $this->assertTrue( $result );
    234         $this->assertEquals(
     234        $this->assertSame(
    235235            $datetime->format( 'Y-m-d H:i:s' ),
    236236            $fetched_comment->comment_date,
Note: See TracChangeset for help on using the changeset viewer.