Make WordPress Core

Opened 7 months ago

Closed 7 months ago

Last modified 7 months ago

#59476 closed enhancement (fixed)

Tests: Add coverage for Patterns registry

Reported by: bernhard-reiter's profile Bernhard Reiter Owned by: bernhard-reiter's profile Bernhard Reiter
Milestone: 6.4 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

We do not currently seem to have any unit test coverage for the Patterns registry (WP_Block_Patterns_Registry). With Block Hooks logic recently added ([56649]), it would be good to add some unit tests to guard that behavior against regressions.

(This is going to be a test-only change, which I believe is still permitted after Feature Freeze.)

Change History (3)

This ticket was mentioned in PR #5299 on WordPress/wordpress-develop by @Bernhard Reiter.


7 months ago
#1

  • Keywords has-patch has-unit-tests added

WIP. Modelled after tests/phpunit/tests/blocks/wpBlockTypeRegistry.php; still need to remove a few of those test cases and add ones for the pattern registry (which doesn't have any coverage yet?)

The goal is to cover hooked block insertion (https://github.com/WordPress/wordpress-develop/pull/5261) in get_registered and get_all_registered.

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

#2 @Bernhard Reiter
7 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 56733:

Blocks: Add unit test coverage for Patterns registry.

Prior to this changeset, we did not seem to have any unit test coverage for the Patterns registry (WP_Block_Patterns_Registry).

With Block Hooks logic recently added ([56649]), it is particularly advisable to add some unit tests to the get_registered() and get_all_registered() methods to guard hooked block insertion against regressions.

Fixes #59476.

Note: See TracTickets for help on using tickets.