[wp-trac] [WordPress Trac] #38266: Tests: Use assertSame() when the type of the value in the assertion is important

WordPress Trac noreply at wordpress.org
Fri Sep 4 07:01:16 UTC 2020


#38266: Tests: Use assertSame() when the type of the value in the assertion is
important
-----------------------------------+-----------------------------
 Reporter:  johnbillion            |       Owner:  SergeyBiryukov
     Type:  defect (bug)           |      Status:  accepted
 Priority:  normal                 |   Milestone:  5.6
Component:  Build/Test Tools       |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  needs-unit-tests php8  |     Focuses:
-----------------------------------+-----------------------------

Comment (by SergeyBiryukov):

 In [changeset:"48939" 48939]:
 {{{
 #!CommitTicketReference repository="" revision="48939"
 Tests: Introduce `assertSameSets()` and `assertSameSetsWithIndex()`, and
 use them where appropriate.

 This ensures that not only the array values being compared are equal, but
 also that their type is the same.

 These new methods replace most of the existing instances of
 `assertEqualSets()` and `assertEqualSetsWithIndex()`.

 Going forward, stricter type checking by using `assertSameSets()` or
 `assertSameSetsWithIndex()` should generally be preferred, to make the
 tests more reliable.

 Follow-up to [48937].

 See #38266.
 }}}

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


More information about the wp-trac mailing list