Skip to content
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

Position Block Support: Add PHP tests #47626

Merged
merged 3 commits into from
Feb 2, 2023

Conversation

andrewserong
Copy link
Contributor

What?

Part of #47043 and following on from #46142

Add PHP tests for the position block support.

Why?

  • To ensure the block support is outputting styles in an expected way.
  • As preparation for backporting the feature to core.

How?

  • Add a PHP test file for the position support
  • Copy the approach from the layout block support that uses theme switching
  • For testing position output, reuse the fluid typography test theme as it opts in to the appearance tools
  • Test for:
    • Correct position output
    • Don't output when the theme doesn't support it
    • Don't output when the block doesn't support it
    • Don't output rules when the position type is invalid

Testing Instructions

Check that the PHP tests Github action passes, or run manually via:

npm run test:unit:php -- --filter WP_Block_Supports_Position_Test

@andrewserong andrewserong added [Type] Code Quality Issues or PRs that relate to code quality [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi labels Feb 1, 2023
@andrewserong andrewserong self-assigned this Feb 1, 2023
@andrewserong andrewserong changed the title Position Support: Add PHP tests Position Block Support: Add PHP tests Feb 1, 2023
@github-actions
Copy link

github-actions bot commented Feb 1, 2023

Flaky tests detected in 0bb453e.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4061201904
📝 Reported issues:

Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the added tests @andrewserong 👍

I've run the tests locally and they pass as per the Github action. The code looks good to me except for a small copy/paste typo.

Happy to approve this pending the suggested tweak. Nice work!

phpunit/block-supports/position-test.php Outdated Show resolved Hide resolved
Co-authored-by: Aaron Robertshaw <[email protected]>
@andrewserong andrewserong enabled auto-merge (squash) February 2, 2023 01:41
@andrewserong
Copy link
Contributor Author

Excellent, thanks for the speedy review and spotting the typo! Committed and enabled auto-merge 👍

@andrewserong andrewserong merged commit 584ec05 into trunk Feb 2, 2023
@andrewserong andrewserong deleted the add/php-tests-for-position-block-support branch February 2, 2023 02:12
@github-actions github-actions bot added this to the Gutenberg 15.2 milestone Feb 2, 2023
@Mamaduka Mamaduka added Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) labels Feb 3, 2023
Mamaduka pushed a commit that referenced this pull request Feb 3, 2023
* Position Support: Add PHP tests

* Remove unneeded queries line

* Update code comment

Co-authored-by: Aaron Robertshaw <[email protected]>

---------

Co-authored-by: Aaron Robertshaw <[email protected]>
@Mamaduka
Copy link
Member

Mamaduka commented Feb 3, 2023

I just cherry-picked this PR to the release/15.1 branch to get it included in the next release: 752ec31

@Mamaduka Mamaduka removed Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants