-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Speculative Loading WP Core API, loading the plugin's own API implementation conditionally #1883
Conversation
… on API implementation conditionally while maintaining compatibility on plugin-specific filters.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
* | ||
* @since 1.0.0 | ||
*/ | ||
function plsr_print_speculation_rules(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewers: This function was moved without any changes to the plugin-api.php
file.
/** | ||
* @covers ::plsr_print_speculation_rules | ||
*/ | ||
public function test_plsr_print_speculation_rules_without_html5_support(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewers: These tests for the plsr_print_speculation_rules()
function were moved to test-speculation-rules-plugin-api.php
without any changes.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #1883 +/- ##
==========================================
+ Coverage 67.90% 67.91% +0.01%
==========================================
Files 86 87 +1
Lines 6997 7012 +15
==========================================
+ Hits 4751 4762 +11
- Misses 2246 2250 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, other than that @covers
tags should be added to the new test case.
Summary
Following the WordPress Core merge of speculative loading last week, this PR ensures the Speculative Loading plugin uses the WP Core API when available, and only loads its own API implementation if not.
Relevant technical choices
PLSR_URL_Pattern_Prefixer
class), and only add the relevant hooks.The fact that WP Core
trunk
tests pass with this is a good indicator this works as expected. Also check in the PHPUnit test run usingtrunk
on GitHub Actions that for Speculative Loading (50 tests) it makes 1 assertion more than for the other WordPress versions (104 instead of 103) because of the one additional hook checked.