docker-compose-wordpress icon indicating copy to clipboard operation
docker-compose-wordpress copied to clipboard

PHPUnit Polyfills library is a requirement

Open MikeiLL opened this issue 3 years ago • 4 comments

Hi, Chris. Not sure if you're maintaining this anymore. I hadn't used it in a while and am suddenly getting the following error when running

docker-compose -f docker-compose.phpunit.yml run --rm wordpress_phpunit phpunit

It returns:

Error: The PHPUnit Polyfills library is a requirement for running the WP test suite.
If you are trying to run plugin/theme integration tests, make sure the PHPUnit Polyfills library (https://github.com/Yoast/PHPUnit-Polyfills) is available and either load the autoload file of this library in your own test bootstrap before calling the WP Core test bootstrap file; or set the absolute path to the PHPUnit Polyfills library in a "WP_TESTS_PHPUNIT_POLYFILLS_PATH" constant to allow the WP Core bootstrap to load the Polyfills.

If you are trying to run the WP Core tests, make sure to set the "WP_RUN_CORE_TESTS" constant to 1 and run `composer update -W` before running the tests.
Once the dependencies are installed, you can run the tests using the Composer-installed version of PHPUnit or using a PHPUnit phar file, but the dependencies do need to be installed whichever way the tests are run.

MikeiLL avatar Sep 29 '22 23:09 MikeiLL

Not sure if it makes sense to add composer and PHPUnit Polyfills to the pulled in image, or if the included image (five years old) is out of date. Looking into adding PHPUnit to a variation of https://github.com/docker-library/wordpress

MikeiLL avatar Oct 01 '22 19:10 MikeiLL

This person's fork of this repo appears to address the issue by adding Composer, also a composer.json file.

I ended up going a different route altogether.

MikeiLL avatar Oct 05 '22 12:10 MikeiLL

Interesting, I have mostly moved to wp-env but I will look to see if I can incorporate your learnings here. Thank you!

chriszarate avatar Oct 05 '22 14:10 chriszarate

Thanks for the link. That hadn't crossed my radar yet.

MikeiLL avatar Oct 05 '22 18:10 MikeiLL