[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
Wed Feb 10 13:24:39 UTC 2021


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

Comment (by SergeyBiryukov):

 In [changeset:"50284" 50284]:
 {{{
 #!CommitTicketReference repository="" revision="50284"
 Tests: Use `assertSame()` in some newly introduced tests.

 This ensures that not only the return values match the expected results,
 but also that their type is the same.

 Going forward, stricter type checking by using `assertSame()` should
 generally be preferred to `assertEquals()` where appropriate, to make the
 tests more reliable.

 Follow-up to [49904], [49925], [49992], [50012], [50013], [50065],
 [50075], [50131], [50150], [50157].

 See #38266, #52482.
 }}}

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


More information about the wp-trac mailing list