Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #52482, comment 4


Ignore:
Timestamp:
02/10/2021 09:02:59 AM (4 years ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #52482, comment 4

    initial v1  
    11If 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:ticket:38266 (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.
    22
    3 Would it be appropriate to add an automated check for this, or at least recommend using `assertSame()` in the core contributor handbook? I've updated the examples in [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/ Writing PHPUnit Tests] to use `assertSame()`, but perhaps we could also be explicitly state somewhere that it should be preferred to `assertEquals()` where possible.
     3Would it be appropriate to add an automated check for this, or at least recommend using `assertSame()` in the core contributor handbook? I've updated the examples in [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/ Writing PHPUnit Tests] to use `assertSame()`, but perhaps we could also explicitly state somewhere that it should be preferred to `assertEquals()` where possible.
    44
    55Replying to [comment:3 jrf]: