Skip to content

Fix test failures due to WP 6.4 change - #881

Merged
swissspidy merged 2 commits into
trunkfrom
fix/wp-64-test-incompatibility
Nov 14, 2023
Merged

Fix test failures due to WP 6.4 change#881
swissspidy merged 2 commits into
trunkfrom
fix/wp-64-test-incompatibility

Conversation

@felixarntz

@felixarntz felixarntz commented Nov 13, 2023

Copy link
Copy Markdown
Member

Summary

As of the WordPress 6.4 release, our unit tests are failing. This hasn't happened yet in trunk, but only because no PRs have been opened since the release. It is however obvious in https://github.com/WordPress/performance/actions/runs/6851370708/job/18627496026?pr=864.

The failures happen simply because of deprecation warnings for print_emoji_styles() which per core behavior remains added as a callback for the wp_print_styles action but normally gets removed via another core function before it would be executed. In certain custom situations though (such as tests), it may be necessary to manually remove it. Even core itself does that for example in https://github.com/WordPress/wordpress-develop/blob/d66ef46847e2340c613d0a01c36d4fcc4b5f3a6b/src/wp-includes/block-editor.php#L363.

Checklist

  • PR has either [Focus] or Infrastructure label.
  • PR has a [Type] label.
  • PR has a milestone or the no milestone label.

@swissspidy

Copy link
Copy Markdown
Member

I feel like we should reconsider the approach with how this function is handled in core. I don't see why the function still needs to be hooked into wp_print_styles just so everyone has to unhook it again. That seems like worse DX than just unhooking it by default.

See also https://core.trac.wordpress.org/ticket/59892

Comment thread tests/modules/js-and-css/audit-enqueued-assets/audit-enqueued-assets-test.php Outdated
@felixarntz

Copy link
Copy Markdown
Member Author

@swissspidy

I feel like we should reconsider the approach with how this function is handled in core. I don't see why the function still needs to be hooked into wp_print_styles just so everyone has to unhook it again. That seems like worse DX than just unhooking it by default.

This was done for backward compatibility with existing code. It's a clunky DX, but it's a tradeoff between breaking BC and clunky DX. I don't feel strongly either way. cc @westonruter

I've addressed your code feedback in a3bc55d.

@westonruter

Copy link
Copy Markdown
Member

What is this about:

Warning: file_put_contents(/var/www/html/wp-content/plugins/performance/.phpunit.result.cache): failed to open stream: Permission denied in phar:///usr/local/bin/phpunit/phpunit/Runner/DefaultTestResultCache.php on line 111

@swissspidy

Copy link
Copy Markdown
Member

This was done for backward compatibility with existing code.

Yes I saw that in the code comments, but I wonder if it actually addresses a real backward compatibility issue.

@swissspidy
swissspidy merged commit 5b95f6b into trunk Nov 14, 2023
@swissspidy
swissspidy deleted the fix/wp-64-test-incompatibility branch November 14, 2023 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no milestone PRs that do not have a defined milestone for release [Type] Bug An existing feature is broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants