d94a9551d2
* Add WooCommerce version selection The WC_VERSION environment variable is added to the docker-compose config. If the variable is not set on the shell, it defaults to the minimum supported version (4.5.0) The ENTRYPOINT is changed to automatically re-install the test suite when the version number is changed. * Add documentation * Add versioning to force image rebuild |
||
---|---|---|
.. | ||
Dockerfile | ||
docker-compose.yml | ||
entrypoint.sh | ||
readme.md |
readme.md
Docker PHP Test Suite
A docker app to run the PHP Test Suite.
Getting Started
For convenience, the PHP Test Suite can be run from an npm script.
npm run test:php
This runs the the phpunit
container with docker-compose -f run --rm phpunit
. On first use, the container will install the PHP Test Suite and perform the tests. Subsequent use will only perform the tests.
Re-install Test Suite
Re-installation is useful to update WordPress to the latest version. To do this, remove the existing test-suite
volume using Docker. For example:
docker volume rm -f wc-admin-php-test-suite_test-suite
Then run the test suite normally using the npm script. Installation will be automatically performed.
Testing a single test case
PHPUnit flags can be passed to the npm script. To limit testing to a single test case, use the --filter
flag.
npm run test:php -- --filter=<name of test>
Selecting the WooCommerce Version
By default, the minimum supported version of WooCommerce is used to build the test suite. This can be overridden with an environment variable.
WC_VERSION=4.9.0 npm run test:php
Development
When comitting changes to the Dockerfile
or entrypoint.sh
files, bump the wc-admin-php-test-suite-phpunit
image tag version in docker-composer.xml
. This will result in an image rebuild automatically upon next use, enabling the changes to be applied for all users.