Installation and configuration of PHPUnit in Windows
Web Server:WampServer Version 2.0
Attention: if you install a new version PHP, after the installation, it is better to check the environment variable PHP_PEAR_PHP_BIN is point to the new folder of PHP. And the php.ini which will used by command line is the one you could find in the new folder of PHP.
Go to the folder of PHP :
> cd c:\wamp\bin\php\php5.3.0
By default, there is file which is called go-pear.bat, execute it :
For someone who has problem in the following steps, it maybe solved by this:Download the newest phar for pear from: http://pear.php.net/manual/en/installation.getting.php
And put it in c:\wamp\bin\php\php5.3.0\PEAR, then launch the command line:
> php go-pear.phar
Remarkable for php 5.3.5In case of error “phar does not have a signaturePHP”, edit the file php.ini(c:\wamp\bin\php\php5.3.5), find the line “phar.require_hash”, normally it is in comment, just uncomment it and change its value to Off.
During the installation, you will find the following screen-shots. What you have to attention and modify will be the 11 and 12.
Normally, we will do this to find the configuration files easily in the future.11. Name of configuration file : C:\wamp\bin\php\php5.3.5\pear.ini 12. Path to CLI php.exe : C:\wamp\bin\php\php5.3.5\.
Then tape Enter to continue…
Execute the file PEAR_ENV.reg to generate the environment variable automatically.> PEAR_ENV.reg
PHPUnit needs curl, so it should uncomment or add this line in php.ini :Extension=php_curl.dll
Installation PHPUnit with Pear
First, add the channels of PHPUnit for Pear>pear channel-discover pear.phpunit.de >pear channel-discover pear.phpunit.de >pear channel-discover pear.phpunit.de
Second, upgrade pear:> pear upgrade-all
Third, install phpunit:> pear install –a phpunit/PHPUnit
or> pear install –alldeps phpunit/PHPUnit
If you have finished all the steps and let pear write in your php configuration file, you will find these lines in your php.ini;***** Added by go-pear include_path=".;C:\wamp\bin\php\php5.3.0\pear" ;*****
And you should add these lines into the bottom of the configuration file of Apache, in
Now if you launch the command line to list the package of Pear, you should see this:> pear list -a
PHPUnit 3.5.13 stable (ou 3.6.3 pour php 5.3.5)
And now, if you launch the command line:> phpunit –version
If it display the version, it means your PHPUnit has been installed.
Note: If you have a problem of “No realeases abailable for package pear.phpunit.de/PHPUnit”, you could do this in Terminal:> pear update-channels > pear clear-cacheIf you have a problem of "PHP Warning: require_once(File/Iterator/Autoload.php): failed to open stream, No such file or directory in C:\wamp\bin\php\php5.3.0\PEAR\PHPUnit\Autoload.php";***** Added by go-pear include_path=".;C:\wamp\bin\php\php5.3.0\PEAR;C:\wamp\bin\php\php5.3.0\PEAR\PEAR" ;*****0.000000 0.000000