PHPUnit Installation Guides

Core PHPUnit setup

Add a (development-time) dependency on phpunit/phpunit to your project’s composer.json file if you use Composer to manage the dependencies of your project:

composer require --dev phpunit/phpunit ^9.5

You can run PHPUnit tests by running the command from plugin root directory.

./vendor/bin/phpunit

References:

  1. https://andy-carter.com/blog/phpunit-what-why-how
  2. https://fortegrp.com/the-importance-of-unit-testing/#:~:text=Unit testing ensures that all,write better code%2C more efficiently.
  3. https://phpunit.readthedocs.io/en/9.5/installation.html