Téléchargez d’abord Composer. Placez vous dans le répertoire de votre choix (vérifiez naturellement que vous y avez les droits d’écriture) et tapez :
curl -sS https://getcomposer.org/installer | php
ensuite vous installez phpUnit à proprement parler :
php composer.phar require "phpunit/phpunit"
Please provide a version constraint for the phpunit/phpunit requirement: 3.7.*
composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing symfony/yaml (v2.2.1)
Downloading: 100%
- Installing phpunit/php-text-template (1.1.4)
Downloading: 100%
- Installing phpunit/phpunit-mock-objects (1.2.3)
Downloading: 100%
- Installing phpunit/php-timer (1.0.4)
Downloading: 100%
- Installing phpunit/php-token-stream (1.1.5)
Downloading: 100%
- Installing phpunit/php-file-iterator (1.3.3)
Downloading: 100%
- Installing phpunit/php-code-coverage (1.2.9)
Downloading: 100%
- Installing phpunit/phpunit (3.7.19)
Downloading: 100%
phpunit/php-code-coverage suggests installing ext-xdebug (>=2.0.5)
phpunit/phpunit suggests installing phpunit/php-invoker (>=1.1.0,<1.2.0)
Vérifiez la bonne tenue de votre fichier composer.json :
cat composer.json
{
"require": {
"phpunit/phpunit": "3.7.*"
}
}
Vous trouverez l’exécutable phpunit dans le sous-répertoire « vendor/bin ». Lancez le et vous verrez la traditionnelle liste des options s’afficher à l’écran !
Bons tests unitaires !
