[wp-trac] [WordPress Trac] #38266: Tests: Use assertSame() when the type of the value in the assertion is important

WordPress Trac noreply at wordpress.org
Wed Feb 10 07:52:09 UTC 2021


#38266: Tests: Use assertSame() when the type of the value in the assertion is
important
-----------------------------------+-----------------------------
 Reporter:  johnbillion            |       Owner:  SergeyBiryukov
     Type:  task (blessed)         |      Status:  closed
 Priority:  normal                 |   Milestone:  5.7
Component:  Build/Test Tools       |     Version:
 Severity:  normal                 |  Resolution:  fixed
 Keywords:  needs-unit-tests php8  |     Focuses:
-----------------------------------+-----------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:32 johnbillion]:
 > There's more than 700 instances of `assertEquals` in use and quite a few
 of those are still checking falsey values.

 If we ignore `assertEqualsWithDelta()` and search specifically for
 `assertEquals()`, there are currently 653 matches in 128 files. This has
 gone up a bit since WordPress 5.6: comment:19 (572 matches in 121 files),
 so apparently some newly introduced tests use `assertEquals()` instead of
 `assertSame()`. Some of those were corrected in [49126] and [49547], but
 more were added in 5.7.

 Let's continue on #52482 though :)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/38266#comment:34>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list