[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
Sun Sep 6 02:52:00 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:"48948" 48948]:
 {{{
 #!CommitTicketReference repository="" revision="48948"
 Tests: Correct assertion in `Tests_Cache::test_miss()`.

 On failure to retrieve contents, `WP_Object_Cache::get()` returns `false`,
 not `null`.

 The test only passed accidentally due to `assertEquals()` not performing a
 strict type check.

 Props johnbillion.
 See #38266.
 }}}

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


More information about the wp-trac mailing list