chriszarate / docker-compose-wordpress

An example Docker Compose setup for WordPress plugin or theme development.
162 stars 54 forks source link

PHPUnit Polyfills library is a requirement #25

Open MikeiLL opened 2 years ago

MikeiLL commented 2 years ago

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 commented 1 year ago

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 commented 1 year ago

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.

chriszarate commented 1 year ago

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

MikeiLL commented 1 year ago

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