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

    r47122 r48937  
    7979        );
    8080
    81         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     81        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    8282    }
    8383
     
    105105        );
    106106
    107         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     107        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    108108    }
    109109
     
    130130        );
    131131
    132         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     132        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    133133    }
    134134
     
    155155        );
    156156
    157         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     157        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    158158    }
    159159
     
    180180        );
    181181
    182         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     182        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    183183    }
    184184
     
    208208        );
    209209
    210         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     210        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    211211    }
    212212
     
    238238        );
    239239
    240         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     240        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    241241    }
    242242
     
    268268        );
    269269
    270         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     270        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    271271    }
    272272
     
    285285        );
    286286
    287         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     287        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    288288    }
    289289
     
    317317        );
    318318
    319         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     319        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    320320    }
    321321
     
    343343        );
    344344
    345         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     345        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    346346    }
    347347
     
    368368        );
    369369
    370         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     370        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    371371    }
    372372
     
    392392        );
    393393
    394         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     394        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    395395    }
    396396
     
    417417        );
    418418
    419         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     419        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    420420    }
    421421
     
    441441        );
    442442
    443         $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
     443        $this->assertSame( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    444444    }
    445445
Note: See TracChangeset for help on using the changeset viewer.