Installing PhpUnit on windows

How to install PHPUnit on windows?

Before proceed you must ask, "what is PHPUnit?". Well, I was learning Yii, a web application MVC framework and read about a program that can automatically test our application as a real user, that program is PHPUnit developed by Sebastian Bergmann. This program is written as php classes and can automate testing work for you like unit test and functional test. Then I decided to install and use it as it is not bundled with php.

So here are some help for you if you wish to go with PHPUnit.

If you want to download file for windows check this. But best way is to install via cmd. Its simple and fast.

1-Open cmd (press window key +r. Then type cmd and then press enter key)
2.Go to php path in your installation (if you have installed xampp in d drive then type in cmd prompt cd d: then press enter. Now type cd xampp\php then press enter )
2-check your php version (type php -v)
3-Now check if PHPUnit is installed or not (type phpunit -v)
4-if it shows something like PHPUnit 3.7.21 by Sebastian Bergmann. then you have already installed it.


In case you don't have installed it type following commands

pear channel-update pear.php.net
pear upgrade-all
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear update-channels

These will take some time so be patient. You can see progress in cmd. Once it all finishes run this command

pear install --alldeps --force phpunit/PHPUnit

It will download phpunit in your xampp. You can check it now as in step 4.
Enjoy.




Post a Comment