Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#56664 closed defect (bug) (fixed)

Add unit test for non-existing block-styles registration

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

Description (last modified by aristath)

Change History (12)

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


4 years ago
#1

  • Keywords has-patch added

#2 @mukesh27
4 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
4 years ago

  • Description modified (diff)

#4 @aristath
4 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
4 years ago

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

#6 @aristath
4 years ago

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

#7 @mukesh27
4 years ago

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

#8 @aristath
4 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
4 years ago

  • Description modified (diff)
  • Severity majornormal
  • Summary Blocks try to load non-existent block-styles on the frontendAdd unit test for non-existing block-styles registration

#10 @audrasjb
4 years ago

  • Keywords commit added
  • Owner set to audrasjb
  • Status newaccepted

Self assigning for commit.

#11 @audrasjb
4 years ago

  • Resolutionfixed
  • Status acceptedclosed

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.