[wp-trac] [WordPress Trac] #52482: Tests: Reduce usage of assertEquals() for 5.8

WordPress Trac noreply at wordpress.org
Tue Feb 9 21:19:36 UTC 2021


#52482: Tests: Reduce usage of assertEquals() for 5.8
-----------------------------------+---------------------
 Reporter:  johnbillion            |       Owner:  (none)
     Type:  task (blessed)         |      Status:  new
 Priority:  normal                 |   Milestone:  5.8
Component:  Build/Test Tools       |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  needs-unit-tests php8  |     Focuses:
-----------------------------------+---------------------
Changes (by johnbillion):

 * keywords:  needs-unit-tests => needs-unit-tests php8


Old description:

> Follow-up to:
>
> * #38266 for 5.7
>
> The `assertEquals()` test method does not check that the types of the
> expected and actual values match. This can hide subtle bugs especially
> when the values are falsey.
>
> Tasks:
>
> * Use `assertSame()` when the type of the value in the assertion is
> important
> * Replace overall usage of `assertEquals()` with type-strict assertion
> methods, with the aim of potentially removing its usage altogether

New description:

 Follow-up to:

 * #38266 for 5.7

 The `assertEquals()` test method does not check that the types of the
 expected and actual values match. This can hide subtle bugs especially
 when the values are falsey.

 Tasks:

 * Switch to using `assertSame()` when the type of the value in the
 assertion is important
 * Replace overall usage of `assertEquals()` with type-strict assertion
 methods, with the aim of potentially removing its usage altogether

--

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


More information about the wp-trac mailing list