How to install PHPUnit on Windows


Note to self in case I need to do this again...

Commands assumes the PHP install is in C:\wamp\bin\php\php5.3.13 and that this path is already added to the PATH environment variable.

Install PEAR

  1. Download go-pear.phar and Save it as C:\wamp\bin\php\php5.3.13\pear\go-pear.phar.
  2. Open an elevated command prompt.
  3. Go to the PHP directory:
cd \wamp\bin\php\php5.3.13
  1. Install PEAR, pressing enter to accept defaults and Y to alter php.ini:
php .\pear\go-pear.phar
  1. Add environment variables:
start PEAR_ENV.reg

Install PhpUnit

  1. Make sure pear is fully up to date (should be if we just installed it):
pear upgrade-all
  1. Add pear channels:
pear channel-discover
pear channel-discover
pear channel-discover
  1. Install PHPUnit with all dependencies:
pear install --alldeps phpunit/PHPUnit
  1. Verify installation by checking version:
phpunit --version