Opened 14 months ago
Closed 9 months ago
#59655 closed task (blessed) (fixed)
Tests: Reduce usage of assertEquals for 6.5
Reported by: | hellofromTonya | Owned by: | |
---|---|---|---|
Milestone: | 6.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
Follow-up to:
- #58956 (6.4)
- #57855 (6.3)
- #56800 (6.2)
- #55654 (6.1)
- #54726 (6.0)
- #53364 (5.9)
- #52482 (5.8)
- #38266 (5.7)
The assertEquals()
test method does not check that the types of the expected and actual values match. This can hide subtle bugs especially when the values are falsey.
Tasks:
- Switch to using
assertSame()
when the type of the value in the assertion is important - Replace overall usage of
assertEquals()
with type-strict assertion methods, with the aim of potentially removing its usage altogether
To help ease the effort of merging tests, changes should also be made upstream in the Gutenberg repository.
Change History (11)
This ticket was mentioned in PR #1768 on WordPress/wordpress-develop by @costdev.
10 months ago
#2
- Keywords has-patch has-unit-tests added
This PR replaces assertEquals()
with more appropriate, stricter assertions where possible and without making any changes to source.
For easier reviewing, commits have been separated based on the replacement assertion and any additional changes required to implement the stricter assertion.
Trac ticket: https://core.trac.wordpress.org/ticket/59655
Trac ticket: https://core.trac.wordpress.org/ticket/55654
In 57244: