[wp-trac] [WordPress Trac] #53364: Tests: Reduce usage of assertEquals for 5.9
WordPress Trac
noreply at wordpress.org
Tue Dec 14 14:35:24 UTC 2021
#53364: Tests: Reduce usage of assertEquals for 5.9
-------------------------------------------+---------------------
Reporter: desrosj | Owner: (none)
Type: task (blessed) | Status: new
Priority: normal | Milestone: 5.9
Component: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: php8 has-patch has-unit-tests | Focuses:
-------------------------------------------+---------------------
Comment (by SergeyBiryukov):
Replying to [comment:6 costdev]:
> What about two additional assertions that are just aliases of
`assertEquals()`?
>
> {{{#!php
> // For two objects.
> // We can't strictly compare objects in most cases anyway,
> // so this name should be safe and the implied comparison
> // is accurate in all but object id.
> public function assertSameObjects( $expected, $actual, $message = '' ) {
> $this->assertEquals( $expected, $actual, $message );
> }
>
> // For arrays containing objects.
> public function assertSameSetsWithObjects( $expected, $actual, $message
= '' ) {
> $this->assertEquals( $expected, $actual, $message );
> }
> }}}
This sounds like a great idea to me!
> So, a call for opinions:
>
> 1. Should we add the two aliases to make our lives easier going forward?
> 2. Should we cast `ceil()` to `int` where appropriate to help us
implement stricter comparison?
I'd say yes to both.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53364#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list