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

Style Engine: move PHP unit tests to Gutenberg #44722

Merged
merged 2 commits into from
Oct 7, 2022

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Oct 6, 2022

WAS?

Greetings humans!

This PR moves style engine PHP unit tests to Gutenberg /phpunit directory and adds 'Gutenberg' and 'gutenberg' prefixes/suffixes.

I thought about adding a build step to copy/search/replace the tests, thereby keeping the PHP unit tests in the package folder, but decided against it because:

  • adding more steps to the watch task might slow it down
  • rebuilding unit tests in order to run them would probably be annoying
  • new features are specific to the Gutenberg plugin anyway

WARUM?

After 6.1, the style engine classes and methods are in Core.

Moving the tests and using the Gutenberg functions and classes allows us to continue development and avoid class collisions.

This PR also proposes to add a bash script to make Core backporting more easy.

The script and .gitignore files are optional and are only there to spark discussion. I'm thinking we shouldn't commit them.

WIE?

Manually relocating files and adding _Gutenberg class and gutenberg_ function suffixes/prefixes.

Testing Instructions

Lint and run all the tests!!

npm run test:php 

Or run a single test using the test class name!!

Example:

npm run test:unit -- --filter WP_Style_Engine_Test
npm run test:unit -- --filter WP_Style_Engine_CSS_Rules_Store_Test

@ramonjd ramonjd added [Type] Build Tooling Issues or PRs related to build tooling [Package] Style Engine /packages/style-engine labels Oct 6, 2022
@ramonjd ramonjd self-assigned this Oct 6, 2022
…adds '_Gutenberg' and 'gutenberg_' prefixes/suffixes.

After 6.1, the style engine classes and methods are in Core.
Moving the tests and using the Gutenberg functions and classes allows us to continue development and avoid class collisions.
This PR also proposes to add a bash script to make backporting more easy.
@ramonjd ramonjd force-pushed the update/move-style-engine-php-unit-tests-to-gutenberg branch from a7a9e09 to 88eff63 Compare October 6, 2022 04:50
@@ -0,0 +1,59 @@
#!/bin/bash
Copy link
Member Author

Choose a reason for hiding this comment

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

I reckon we don't really need something like this. I'll remove it in a future commit.

Doing it via IDE is just as fast and means less work.

I just wanted to make sure we don't need to worry that the PHP unit tests no longer live in the package file.

The Core tests exist as well so I think we're covered.

Copy link
Contributor

Choose a reason for hiding this comment

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

I kinda love the idea of including bash scripts somewhere to make this process a little easier. But yes, maybe in another PR? There could potentially be a good home for it in /bin/ somewhere?

Update CHANGELOG.md
Copy link
Contributor

@andrewserong andrewserong 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 updates here! Just gave this is a quick test, the tests are passing for me, looks like you captured all the wp → gutenberg conversions, and the removal of the packages test suite appears to be safe since it was only used by the style engine package.

LGTM!

@ramonjd ramonjd merged commit 8ed501d into trunk Oct 7, 2022
@ramonjd ramonjd deleted the update/move-style-engine-php-unit-tests-to-gutenberg branch October 7, 2022 00:38
@github-actions github-actions bot added this to the Gutenberg 14.4 milestone Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Style Engine /packages/style-engine [Type] Build Tooling Issues or PRs related to build tooling
Projects
Status: 🏆 Done
Development

Successfully merging this pull request may close these issues.

2 participants