Make WordPress Core

Opened 7 weeks ago

Last modified 7 weeks ago

#62278 new task (blessed)

Tests: Reduce usage of assertEquals for 6.8

Reported by: desrosj's profile desrosj Owned by:
Milestone: 6.8 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch has-unit-tests
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 merging tests, changes should also be made upstream in the Gutenberg repository.

Change History (2)

This ticket was mentioned in PR #4132 on WordPress/wordpress-develop by @Rahmohn.


7 weeks ago
#1

  • Keywords has-patch has-unit-tests added

This PR updates the test test_wp_count_attachments_should_cache_the_result to check the properties of the object returned instead of checking the object with assertEquals. That way, we guarantee the expected properties of the object.

Trac ticket: https://core.trac.wordpress.org/ticket/62278

#2 @desrosj
7 weeks ago

  • Type changed from defect (bug) to task (blessed)
Note: See TracTickets for help on using tickets.