create-block-theme icon indicating copy to clipboard operation
create-block-theme copied to clipboard

Add integration tests

Open vcanales opened this issue 1 year ago • 2 comments

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

vcanales avatar Jun 07 '23 21:06 vcanales

@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

vcanales avatar Jun 08 '23 13:06 vcanales

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 :)

vcanales avatar Jun 09 '23 17:06 vcanales

Added a command to run tests in watch mode. npm run test:php:watch

pbking avatar Mar 11 '24 16:03 pbking