[wp-trac] [WordPress Trac] #30522: WP_UnitTestCase::assertEqualSets can pass incorrectly

WordPress Trac noreply at wordpress.org
Sat Nov 29 19:17:01 UTC 2014


#30522: WP_UnitTestCase::assertEqualSets can pass incorrectly
------------------------------+--------------------
 Reporter:  dd32              |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  4.1
Component:  Build/Test Tools  |     Version:  trunk
 Severity:  normal            |  Resolution:
 Keywords:  has-patch         |     Focuses:
------------------------------+--------------------
Changes (by boonebgorges):

 * milestone:  Awaiting Review => 4.1


Comment:

 The fix to `assertEqualSets` in [attachment:30522.diff] look good to me.

 The use case for `assertEqualSetsWithIndex()` is pretty narrow, but it
 looks fine to me. It'd be swell to have a guide to all of our custom
 assertions, like maybe here https://make.wordpress.org/core/handbook
 /automated-testing/#writing-tests.

 The tests-of-tests should probably go in `tests/phpunit/tests/includes/`.

 > This means that any tests in core which are testing id=>slug such as the
 getTerm tests, should use assertEqualSetsWithIndex()

 Yes. And in fact, this shows a bug in one of our tests (though thankfully
 not `get_terms()` itself!). See [attachment:30522-getTerms.diff].

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


More information about the wp-trac mailing list