-
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
WP_Theme_JSON_Gutenberg Unit tests: fix phpunit warnings about set_spacing_sizes #55313
Conversation
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/class-wp-theme-json-gutenberg.php ❔ phpunit/class-wp-theme-json-test.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.
LGTM - thanks for fixing this.
This code is in Core, so I wonder how changing trigger_error() to _doing_it_wrong() could affect backward compatibility, @matiasbenedetto. |
Thanks @glendaviesnz and @anton-vlasenko for the review.
I think this is not in core because this is the Gutenberg version of this class ( So I think there won't be disruptions. |
I've explained why replacing trigger_error() with _doing_it_wrong() could be an issue here: #55354. |
trigger_error( __( 'Some of the theme.json settings.spacing.spacingScale values are invalid', 'gutenberg' ), E_USER_NOTICE ); | ||
_doing_it_wrong( __METHOD__, __( 'Some of the theme.json settings.spacing.spacingScale values are invalid', 'gutenberg' ), '6.1.0' ); |
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.
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.
But I can also see that Gutnberg trunk
does not contain this change
gutenberg/lib/class-wp-theme-json-gutenberg.php
Lines 3516 to 3518 in fb71e4b
if ( ! empty( $spacing_scale ) ) { | |
trigger_error( __( 'Some of the theme.json settings.spacing.spacingScale values are invalid', 'gutenberg' ), E_USER_NOTICE ); | |
} |
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.
I appears this change was reverted in #55354
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.
...and phpunit changes were commit as part of WordPress/wordpress-develop#5911
✅ I updated the PHP Sync Tracking Issue for WP 6.5 to note this PR does not require a backport for WP 6.5. Why? Because related changes were backported in #55313 instead. cc @matiasbenedetto and @anton-vlasenko for 👍 |
What?
WP_Theme_JSON_Gutenberg
unit tests: fix phpunit warnings aboutset_spacing_sizes()
.Why?
To avoid the warnings on the console:
How?
using core function _doing_it_wrong() to throw the notice and using
setExpectedIncorrectUsage
to assert the incorrect usage notice.Testing Instructions
Run PHP unit tests with and without this change.
You should not see the warning running this PR.