Saturday, 16 April 2011

Installing PHPUnit On Windows

Once you have installed WAMP on your machine, open up the command prompt and go to your php directory in WAMP. Suppose Wamp is installed in C drive.

C:\> cd wamp\bin\php\php5.2.8

From here you must run the go-pear.bat file to installPEARand all the files needed for it.

C:\wamp\bin\php\php5.2.8>go-pear.bat

When executing above command, it will ask you a series of question to set itself up correctly, if you don’t know what to do, then just accept the defaults. But if you are using more than one version of PHP, then select “local” in [system/local] wide copy configuration.

It’ll install pear 1.7.2. If you want to install PHPUnit 3.5, that package is available with PEAR 1.9.1 only. So upgrade it to higher version. To upgrade any pear, Use following command :

C:\wamp\bin\php\php5.2.8>pear upgrade pear

You can check the information of pear from any of the command.

C:\wamp\bin\php\php5.2.8>pear info pear

C:\wamp\bin\php\php5.2.8>pear -V

Once installed you must run the PEAR_ENV.reg which will create the environment variables for the user, so that PEAR can be called in any directory on the command line.

C:\wamp\bin\php\php5.2.8>PEAR_ENV.reg

If you cannot call PEAR from the command prompt, then you must manually add

directory to the path in the System Environment Variables list, then add the directory

"C:\wamp\bin\php\php5.2.8" to the 'PATH' & 'INCLUDE_PATH' variable. Or double click on the file

If it's not there, then you can externally install it from pear site as Pear is required for PHPUnit. You can download go-pear.phar file from http://pear.php.net/go-pear.phar. Put it into php/bin directory and then run it

Support for Composer and PHP Archive (PHAR) was added in PHPUnit 3.7 (and is known to be stable since PHPUnit 3.7.5). Earlier releases of PHPUnit are not available through these distribution channels. If you are using >=3.7 version, you can use anyone PEAR or composer.

After I install phpUnit, and check the version, I get this errordid the searching a solution, some said about config incude_path to PEARbut I already did that on php.ini, nothing happenkind of don't know which file do I have to config?

C:\wamp\bin\php\php5.2.17_vc6_32bit>phpunit --version

Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in C:\wamp\bin\php\php5.2.17_vc6_32bit\PEAR\PHPUnit\Autoload.php on line 45

It has been simply incredibly generous with you to provide openly what exactly many individuals would’ve marketed for an eBook to end up making some cash for their end, primarily given that you could have tried it in the event you wanted.