Opened 3 years ago
Closed 3 years ago
#54726 closed task (blessed) (fixed)
Tests: Reduce usage of assertEquals for 6.0
Reported by: | hellofromTonya | Owned by: | |
---|---|---|---|
Milestone: | 6.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch has-unit-tests needs-refresh |
Focuses: | Cc: |
Description
Follow-up to:
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 backporting tests, changes should also be made upstream in the Gutenberg repository.
Change History (4)
This ticket was mentioned in PR #1768 on WordPress/wordpress-develop by costdev.
3 years ago
#1
- Keywords has-patch has-unit-tests added
This ticket was mentioned in Slack in #core by mike. View the logs.
3 years ago
#3
@
3 years ago
- Keywords needs-refresh added
During a brief discussion in a bug scrub, it was noticed there are conflicts in the PR so I'm marking the ticket as such.
It was decided to leave this on the milestone as it may be worked on during the code freeze in the production source code.
#4
@
3 years ago
- Resolution set to fixed
- Status changed from new to closed
With 6.0 RC1 tomorrow and work ongoing, closing this ticket. #55654 is opened for the 6.1 cycle.
For pending work, re-referenced to the new ticket.
If any commits are ready before 6.0 RC1 release party, please re-open this ticket for the commit See
reference.
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/54726
Update: Moved this PR to 6.0's Trac ticket.