-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add integration tests #393
Conversation
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.
Thanks for working on this! It'd be great to have a suite of tests.
The changes are reading well for me. Are there any commands I can try running locally to test this better? Or maybe just ensure that the new test at tests/test-theme-create-theme.php
passes?
I've added testing instructions to the description.
|
I added a GitHub actions, which you can see working on this very PR. This required me to add back the changes made for #379 to get tests passing :) |
Data url obtained from the official docs, here: https://codex.wordpress.org/Theme_Unit_Test
Starting with the export_child_theme method.
Refactors test installation script for it to be able to run in a CI context without requiring user input try adding test action add mysql setup fix wp config creation command overwrite if it exists create wpconfig before install attempt move musql config to test step fix multiple command syntax add missing command add option to recreate db from cli Helps us skip the prompt for user input move cli options to the end add host to command call refactor to add options at the beginning try different order add missing steps use config create instead of core create skip check on config creation change to 127.0.0.1 as default host install composer dependencies refactor composer action install dev dependencies refactor Lint action silence stdout from test installation script pretty print tests do not profile composer
Required to get sample test passing
This allows us to share dependencies.
Added a command to run tests in watch mode. |
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.
Ready to test now!
To facilitate future improvements to the codebase, this proposes configuring PHPUnit to be able to write tests for the plugin.
This was created using
wp scaffold plugin-test
, plus some modifications to addwp-cli
and theme data to the test site.A first test is included at
tests/test-theme-create-theme.php
.Testing
To run this suite, a local MySQL installation is required. After that is taken care of, the following commands should get everything setup: