This is a WordPress PHPUnit boilerplate for dev with Windows and using LocalWP.
-
Set Local's preference to use Git Bash as shell.
-
Create a test database by opening Site Shell, cd to this plugin, and run
bin/install-wp-tests.sh local_test root root localhost. -
Disable annoying imagick error by going to your site's folder of
conf > php > php.ini.hbsand disable it by adding;in front:[imagick] {{#if os.windows}} ;extension = php_imagick.dll {{else}} ;extension = {{extensionsDir}}/imagick.so {{/if}} -
Restart your site.
-
Install all packages with
composer update.
-
Edit
wp-config.phpto your needs. But leave the DB constant as is. -
Run the test using
composer test. Use the shell from Local, make sure youcdto the plugin's directory before running the test.
That's it, you should see the assertion returning true. Now you can continue writing your unit test.