[wp-trac] [WordPress Trac] #52482: Tests: Reduce usage of assertEquals() for 5.8
WordPress Trac
noreply at wordpress.org
Tue Feb 9 21:41:12 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:
-----------------------------------+---------------------
Comment (by jrf):
> Replace overall usage of assertEquals() with type-strict assertion
methods, with the aim of potentially removing its usage altogether
One note about this: when comparing whether two objects of the same type
are "equal", using `assertEquals()` is still warranted. `assertSame()`
would fail for objects of the same type with the same property values, as
the ID of the object will, in most cases, not be the same.
For a limited number of objects (ValueObjects), it may be possible to
switch the `assertEquals()` out in favour of using
[https://phpunit.readthedocs.io/en/9.5/assertions.html#assertobjectequals
`assertObjectEquals()`] in the future, but that would either require
PHPUnit 9.4+ or a polyfill until that time.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52482#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list