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

[Rock] Add PHP unit tests #1824

Merged
merged 16 commits into from
Nov 2, 2023
Merged

[Rock] Add PHP unit tests #1824

merged 16 commits into from
Nov 2, 2023

Conversation

Soare-Robert-Daniel
Copy link
Contributor

@Soare-Robert-Daniel Soare-Robert-Daniel commented Aug 22, 2023

Closes #1623

Summary

Added units tests for:

  • Dynamic Content query parse and small evaluation test
  • Dynamic Conditions evaluation
  • Stripe_API functions unit test
  • Pro Patterns fetching test

Locally the test can be run with Docker provided by Gutenberg packages.

npm run test:unit:php:setup # start the container
npm run test:unit:php:base # run the tests from `./tests` folder

Test instructions

  1. A slight change was made in Dynamic Content. Have a test instance with the current version, and after switching with the one from this PR, check if it still works.
  2. Same with Stripe -> check Stripe Checkout Block

Checklist before the final review

  • Included E2E or unit tests for the changes in this PR.
  • Visual elements are not affected by independent changes.
  • It is at least compatible with the minimum WordPress version.
  • It loads additional script in frontend only if it is required.
  • Does not impact the Core Web Vitals.
  • In case of deprecation, old blocks are safely migrated.
  • It is usable in Widgets and FSE.
  • Copy/Paste is working if the attributes are modified.
  • PR is following the best practices

@Soare-Robert-Daniel Soare-Robert-Daniel self-assigned this Aug 22, 2023
@Soare-Robert-Daniel Soare-Robert-Daniel linked an issue Aug 22, 2023 that may be closed by this pull request
@Soare-Robert-Daniel Soare-Robert-Daniel marked this pull request as ready for review September 14, 2023 12:01
@pirate-bot
Copy link
Contributor

pirate-bot commented Sep 14, 2023

Bundle Size Diff

Package Old Size New Size Diff
Animations 274.81 KB 274.81 KB 0 B (0.00%)
Blocks 1.47 MB 1.47 MB 0 B (0.00%)
CSS 89.3 KB 89.3 KB 0 B (0.00%)
Dashboard 131.23 KB 131.23 KB 0 B (0.00%)
Export Import 87.19 KB 87.19 KB 0 B (0.00%)
Pro 346.75 KB 346.75 KB 0 B (0.00%)

@pirate-bot
Copy link
Contributor

pirate-bot commented Sep 14, 2023

Plugin build for beec0d9 is ready 🛎️!

@pirate-bot
Copy link
Contributor

pirate-bot commented Sep 14, 2023

E2E Summary

Typing

Test Average Time (ms) Standard Deviation (ms) Median Time (ms) Quantile for soft limit (%) Quantile for hard limit (%)
Typing 73.37 11.87 71.82 10.53 (60ms) 73.68 (80ms)
Values above 60ms "0 - 65.98, 2 - 94.53, 4 - 61.05, 5 - 65.74, 6 - 85.34, 7 - 97.19, 8 - 68.02, 9 - 76.16, 10 - 75.08, 11 - 87.75, 12 - 85.66, 13 - 71.82, 14 - 67.45, 15 - 77.95, 16 - 73.57, 17 - 64.44, 18 - 65.74"

@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Sep 14, 2023
Copy link
Member

@HardeepAsrani HardeepAsrani left a comment

Choose a reason for hiding this comment

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

Can you fix the failing tests before putting it for review? Also, why do we have two separate unit tests actions?

@Soare-Robert-Daniel
Copy link
Contributor Author

I removed the old method. The old method was installing the test instance on the local machine. The new one will use a docker test instance provided by wp-env and wp-scripts.

Copy link
Member

@HardeepAsrani HardeepAsrani left a comment

Choose a reason for hiding this comment

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

LGTM, I've left a NIT but it looks good. We should get a good QA done on these features, Block Conditions in particular as I see there is some code change there to confirm that everything works just like before.

@irinelenache
Copy link
Contributor

@Soare-Robert-Daniel Tested and everything's fine on my end 🚀

@HardeepAsrani HardeepAsrani merged commit afe07db into development Nov 2, 2023
11 of 12 checks passed
@HardeepAsrani HardeepAsrani deleted the dev/php-unit-test branch November 2, 2023 06:08
@pirate-bot
Copy link
Contributor

🎉 This PR is included in version 2.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-checklist-complete The Pull Request checklist is complete. (automatic label) released Indicate that an issue has been resolved and released in a particular version of the product.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Identify and expand Unit testing
4 participants