Add integration tests
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 add wp-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:
# install dependencies
composer install
./bin/install-wp-tests.sh
# run tests
npm run test:php
@mikachan 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.
Testing
To run this suite, a local MySQL installation is required. After that is taken care of, the following commands should get everything setup:
# install dependencies composer install ./bin/install-wp-tests.sh # run tests npm run test:php
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 :)
Added a command to run tests in watch mode. npm run test:php:watch