woocommerce/plugins/woocommerce-admin/docker/wc-admin-php-test-suite
Chi-Hsuan Huang 86fc8b62e5 Switch to pnpm (https://github.com/woocommerce/woocommerce-admin/pull/8349)
* Add pnpm-workspace.yaml

* Add missing dependencies & replace file: with workspace:* in
package.json

* Replace "npm" with "pnpm"

* Replace "npx" with "pnpx"

* Remove package-lock.json

* Add pnpm setup action to github workflows

* Update webpack babel exclude path

* Upgrade woo e2e and fix e2e test command

Update e2e.yml

Use pnpm run e2e:docker-up in e2e.yml

* Remove unused docker-compose.yaml

* Replace lerna with pnpm commands

Update publish commands

* Exclude _locutus_shared_bc.js in babel.config.js

* Add .npmrc to set enable-pre-post-scripts=true by default

* Fix storybook babel config

Update babel.config.js

* Add changelog

* Update pnpm-lock.yaml

* Replace pnpx with pnpm exec

* Update pnpm-lock.yaml

* Remove js-tests/package-lock.json

* Fix @woocommerce/tracks -> workspace:*

* Update pnpm-lock.yaml

* Add @woocommerce/experimental to onboarding/package.json

* Add "@woocommerce/component" to onboarding/package.json

* Update pnpm-lock.yaml

* Use || instead of && for "test:watch"

Co-authored-by: RJ <27843274+rjchow@users.noreply.github.com>

* Fix packages/number "clean" command

* Add root: true to .eslintrc.js to enforce it to use the root config file

* Exclude packages/**/node_modules from babel transpiling

* Fix js-tests build config

Co-authored-by: RJ <27843274+rjchow@users.noreply.github.com>
2022-03-04 12:01:16 +08:00
..
Dockerfile Switch to pnpm (https://github.com/woocommerce/woocommerce-admin/pull/8349) 2022-03-04 12:01:16 +08:00
docker-compose.yml Replace mysql image with mariadb (https://github.com/woocommerce/woocommerce-admin/pull/8220) 2022-01-27 11:28:56 -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 Switch to pnpm (https://github.com/woocommerce/woocommerce-admin/pull/8349) 2022-03-04 12:01:16 +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 pnpm script.

pnpm 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 pnpm script. Installation will be automatically performed.

Testing a single test case

PHPUnit flags can be passed to the pnpm script. To limit testing to a single test case, use the --filter flag.

pnpm 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 pnpm run test:php

Selecting PHP versions

The PHP test suite supports running tests in PHP 7 and 8. We do use a custom PHPUnit fork of version ~7.5 when running tests in PHP 8, for the reasoning why see this WooCommerce Readme.

As mentioned in the readme, when running tests in PHP 8 it will modify the composer files in /bin/composer/phpunit, please remember to not include these changes in any of your commits.

To run tests using PHP 8:

PHP_VERSION=8 pnpm 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.