Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#56664 closed defect (bug) (fixed)

Add unit test for non-existing block-styles registration

Reported by: aristath's profile aristath Owned by: audrasjb's profile audrasjb
Milestone: 6.1 Priority: normal
Severity: normal Version: 6.1
Component: General Keywords: has-patch has-unit-tests commit
Focuses: Cc:

Change History (12)

This ticket was mentioned in PR #3336 on WordPress/wordpress-develop by aristath.


3 years ago
#1

  • Keywords has-patch added

#2 @mukesh27
3 years ago

  • Keywords reporter-feedback added

@aristath in which case we get result for generate_block_asset_handle( $metadata['name'], $field_name, $index )?

Do we need the unit test for this changes?

#3 @aristath
3 years ago

  • Description modified (diff)

#4 @aristath
3 years ago

The issue was introduced in https://github.com/WordPress/wordpress-develop/commit/3381f05fa241daf172d6c1c893fd25959c3b0656#diff-8c99af92e4ec0fdb307ddd9b42be1e1ef1efe4a9f31287c23f346244dddd1ce9R227, where wp_normalize_path() was added on line 227 a few days ago.

Do we need the unit test for this changes?

We should probably add one to prevent something like this from happening in the future. However, writing a test for this one will be a bit more complicated than the existing tests for this function. I'll work on it, but in the meantime, the lack of a future-proofing test should not be considered a blocker for this bugfix.

#5 @aristath
3 years ago

Turns out, the test for this was simpler than I initially believed. Added the test 👍

#6 @aristath
3 years ago

  • Keywords has-unit-tests added; reporter-feedback removed

#7 @mukesh27
3 years ago

Thanks for the unit test. The PR has some conflict that must be resolved.

#8 @aristath
3 years ago

😂 Looks like this was just fixed a few minutes ago in https://core.trac.wordpress.org/changeset/54155
However, that patch does not include a unit-test. I'll change the subject of this ticket, remove the changes in blocks.php from my patch and leave only the PHPUnit test as it should still be relevant with the patch that was pushed.

#9 @aristath
3 years ago

  • Description modified (diff)
  • Severity changed from major to normal
  • Summary changed from Blocks try to load non-existent block-styles on the frontend to Add unit test for non-existing block-styles registration

#10 @audrasjb
3 years ago

  • Keywords commit added
  • Owner set to audrasjb
  • Status changed from new to accepted

Self assigning for commit.

#11 @audrasjb
3 years ago

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

In 54472:

Build/Test Tools: Add unit test for non-existing block-styles registration.

Follow-up to [54155].

Props aristath, mukesh27.
Fixes #56664.

Note: See TracTickets for help on using tickets.