-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Font Library: return null if a font collection is not registered #58735
Conversation
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 Core SVNCore Committers: Use this line as a base for the props when committing in SVN:
GitHub Merge commitsIf 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. |
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/compat/wordpress-6.5/fonts/class-wp-font-library.php ❔ lib/compat/wordpress-6.5/fonts/class-wp-rest-font-collections-controller.php ❔ phpunit/tests/fonts/font-library/wpRestFontCollectionsController.php |
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.
This looks good to me. I see other Core functions vary on whether they return null
or false
in this case, but I think returning null seems most appropriate, as you tried to get something, but there's nothing there.
I see that phpunit tests are failing, I think because the WP_Font_Library
class has already been committed to WordPress trunk, that class is overriding here, and it doesn't yet have the updated method that returns null? @youknowriad @getdave does that seem right? Any advice on how to get CI passing?
I think at this point, we could consider removing the phpunit tests from Gutenberg, because from now on, they will be maintained on Core. That's how we approached this kind of things in the past. |
lib/compat/wordpress-6.5/fonts/class-wp-rest-font-collections-controller.php
Outdated
Show resolved
Hide resolved
A PR removing the tests from the already merged classes: #58752 that we would need to merge before this one. |
Do we need to remove all tests right now? Gutenberg supports the current and previous release of WordPress, so having tests that cover the 6.5 compat code seems to have some value until 6.4 isn't supported any longer. What do you think of just removing that one test, for now, until WP trunk is in sync with these changes? |
you're right, I think the compat tests should stay in Gutenberg because the code they cover will remain in Gutenberg but for the classes that moved to Core, we should remove their tests. |
Removing just some tests makes things difficult to track and could give us confidence that things are being appropriately tested when they could not.
In that case we would we need to find a way to run the tests loading the classes tested from Gutenberg and not from core. I'm not sure how to do that. |
Flaky tests detected in 3b338b1aaf886a50c21f46e30f8296cd23063865. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7805690881
|
Should we add a |
I think @youknowriad might be referring to font code and tests that aren't being ported to Core. The only thing I'm aware of are the fonts bc-layer code, as well as |
@coderkevin Yes, I was indeed referring to these files :) Now for testing the ones that are already on Core, to be honest I don't see a value. What would be good would be to check that they're kept in sync with core classes but we don't have any of that so far and it's not specific to font library. |
This reverts commit eee3710f321180b8bd906adfe17c1aa490aee055.
Co-authored-by: Grant Kinney <creativecoder@users.noreply.github.com>
Co-authored-by: Grant Kinney <creativecoder@users.noreply.github.com>
3b338b1
to
e5690a7
Compare
I've merged #58752 and have rebased this branch, waiting for CI to pass. |
There's still some weirdness here, even with removing the phpunit tests already committed to Core.
For now I've added a check for a WP_Error instance in the controller, which we should remove once WP trunk is updated with the code in this PR. |
…on in current WP trunk
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.
CI is finally passing, so this is now ready to merge.
What?
Font Library: return null if a font collection is not registered
Why?
How?
returning null when a font collection is not registered
Testing Instructions