[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 Oct 9 01:38:37 UTC 2016
#38266: Tests: Use assertSame() when the type of the value in the assertion is
important
------------------------------+----------------------------
Reporter: johnbillion | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Build/Test Tools | Version:
Severity: normal | Keywords: ongoing
Focuses: |
------------------------------+----------------------------
Several tests use `assertEquals()` on a falsey value where the type is
important to the accuracy of the test.
For example, in `Tests_Cache::test_miss()`, a value is tested against an
expected `NULL` value using `assertEquals()` which will produce a false
positive if another falsey value such as `0`, `false`, or an empty string
is passed. These means these such assertions are actually buggy.
Using `assertSame()` instead of `assertEquals()` will cause the type to be
checked in addition to its value.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38266>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list