Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#54726 closed task (blessed) (fixed)

Tests: Reduce usage of assertEquals for 6.0

Reported by: hellofromtonya's profile 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:


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.


  • 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.

2 years ago

  • 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:
Update: Moved this PR to 6.0's Trac ticket.

This ticket was mentioned in Slack in #core by mike. View the logs.

2 years ago

#3 @peterwilsoncc
2 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 @hellofromTonya
2 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.

Note: See TracTickets for help on using tickets.