woocommerce/plugins/woocommerce-admin/docker/wc-admin-php-test-suite
louwie17 b29cd9a6c0 Add support for php8 unit tests (locally and in GH actions) (https://github.com/woocommerce/woocommerce-admin/pull/6678)
* Partial local version to run php8 unit tests

* Remove the post install scripts

* Remove tab

* Make sure woocommerce version contains patch number

* Remove unnecessary script

* Update bin settings and unit test script

* Remove phpunit binary

* Updated how php unit is being run

* Add specific phpunit version for php8

* Update bin phpunit composer.json

* Final cleanup of scripts

* Fix potential test where image is an object

* Move setting image below save

* Add changelog

* Do not convert obj/array to string for email_actions

* Remove some uses of tabs

* Set WP and WC version to minimum php 8 supported

* Remove unnecessary composer install within tests
2021-04-07 14:28:03 -03:00
..
Dockerfile Add support for php8 unit tests (locally and in GH actions) (https://github.com/woocommerce/woocommerce-admin/pull/6678) 2021-04-07 14:28:03 -03:00
docker-compose.yml Add support for php8 unit tests (locally and in GH actions) (https://github.com/woocommerce/woocommerce-admin/pull/6678) 2021-04-07 14:28:03 -03:00
entrypoint.sh Add support for php8 unit tests (locally and in GH actions) (https://github.com/woocommerce/woocommerce-admin/pull/6678) 2021-04-07 14:28:03 -03:00
install-php-version.sh Add support for php8 unit tests (locally and in GH actions) (https://github.com/woocommerce/woocommerce-admin/pull/6678) 2021-04-07 14:28:03 -03:00
readme.md Add WordPress version selection to Docker PHP test suite (https://github.com/woocommerce/woocommerce-admin/pull/6245) 2021-02-09 06:33:01 +08:00

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 WordPress and WooCommerce Versions

By default, the minimum supported versions of WordPress and WooCommerce are used to build the test suite. This can be overridden with environment variables.

WP_VERSION=5.6 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.