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

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

./vendor/bin/phpunit

You can go through this official PHPUnit installation guide for more details. Please check the minimum PHP version requirement before installing it to avoid errors.

References:

  1. PHPUnit What, Why and How?
  2. PHPUnit installation using composer