Pear & PHPUnit On windows

Hello Guys

how to install Pear & PHPUnit On windows?

First you need to add php.exe to your path environment variable. Then follow installation guide on pear website. After that check phpunit website for commands you need to enter in pear console.

Here is step by step guide how to install them on Windows:

http://www.tellingmachine.com/post/Installing-PEAR-and-PHPUnit.aspx

It is important to update phpunit to recent version, otherwise, you might get some errors,

when you use phpunit with yii project.

Also be sure to run cmd as administrator.

I had this issue on both Windows and Linux where the pear that comes pre installed in php is not the most recent which is 1.9.4 and it will give an error because phpunit requires it so before running the commands to install phpunit be sure to do "pear upgrade PEAR" to get the latest pear installer.

Then discover the repo with

pear channel-discover pear.phpunit.de

And istall with

pear install phpunit/PHPUnit

That should install it to your pear directory which is added to your system path will allow you to call phpunit from inside your website directory.

I’ve tried many times and this is the first time I actually got it right and made phpunit work. I’m on the Linux box at the moment so hopefully that will work on windows.