[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 Sep 2 00:35:51 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:"48937" 48937]:
 {{{
 #!CommitTicketReference repository="" revision="48937"
 Tests: First pass at using `assertSame()` instead of `assertEquals()` in
 most of the unit 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.

 Props johnbillion, jrf, SergeyBiryukov.
 See #38266.
 }}}

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


More information about the wp-trac mailing list