PHPUnit

(( gitHubWatchers )) (( gitHubStars )) (( gitHubForks ))

PHPUnit is a programmer-oriented testing framework for PHP.

It provides both a framework that makes the writing of tests easy as well as the functionality to easily run the tests and analyse their results.

It is an instance of the xUnit architecture for unit testing frameworks.

Installation

Install from a Composer package as a dev dependency (with Composer)

Make sure you have Composer installed.

Require it as a dev dependency:
composer require --dev phpunit/phpunit
Run it:
php vendor/bin/phpunit

Install from a PHP Archive (with curl or wget)

The PHPUnit documentation has a clear manual on how to install PHARs on Windows.

If you have the Suhosin extension enabled, make sure to allow the execution of PHARs in your php.ini:
suhosin.executor.include.whitelist = phar

Locally

Download it:
wget -O phpunit.phar https://phar.phpunit.de/phpunit.phar
or
curl -sSL https://phar.phpunit.de/phpunit.phar -o phpunit.phar
Use it:
php phpunit.phar

Globally

Download it:
wget -O phpunit.phar https://phar.phpunit.de/phpunit.phar
or
curl -sSL https://phar.phpunit.de/phpunit.phar -o phpunit.phar
Install it as an executable:
chmod a+x phpunit.phar
sudo mv phpunit.phar /usr/local/bin/phpunit
Use it:
phpunit