[wp-trac] [WordPress Trac] #30522: WP_UnitTestCase::assertEqualSets can pass incorrectly
WordPress Trac
noreply at wordpress.org
Thu Nov 27 05:46:24 UTC 2014
#30522: WP_UnitTestCase::assertEqualSets can pass incorrectly
------------------------------+------------------------------
Reporter: dd32 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
------------------------------+------------------------------
Comment (by dd32):
To be clear, the reason there's 2 functions to replace the existing
function is because `assertEqualSets()` can't be used when you need to
retain index association, my third example in the ticket should not be
using `assertEqualSets()` as you can't effectively match the requirement
for unsorted sets with an incremental numeric key, and a set using a
specified key => val pairs at the same time.
This means that any tests in core which are testing `id=>slug` such as the
getTerm tests, should use `assertEqualSetsWithIndex()` (which could
potentially be called `assertEqualAssocSets()`) so that it can verify that
`[ 1 => 'Term1', 2 => 'Term2' ] != [ 0 => 'Term1', 1 => 'Term2' ]`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30522#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list