PHPUnit for XAMPP on Windows with Cygwin
Steps to get PHPUnit to run on my XAMPP setup with Cygwin, so I can write and run Symfony2 unit tests.
1. Upgrade PEAR
Download
http://pear.php.net/go-pear.phar
to C:\xampp\php\go-pear.pharRun this in cmd.exe (cygwin prompts hosed somehow), taking all defaults
c:\xampp\php>go-pear.bat |
- Yay.
c:\xampp\php>pear version PEAR Version: 1.9.4 PHP Version: 5.3.5 Zend Engine Version: 2.3.0 Running on: Windows NT FAI1046162 6.1 build 7600 (Unknow Windows version Enterpr ise Edition) i586 |
2. Install/upgrade PHPUnit
Now we can use the cygwin shell. Not sure all these channels are needed, I did this out of order.
cd /cygdrive/c/xampp/php pear update-channels pear channel-discover components.ez.no pear channel-discover pear.symfony-project.com pear channel-discover pear.phpunit.de pear install --alldeps phpunit/PHPUnit |
3. Use it
XAMPP and/or PHPUnit come with a wrapper called phpunit.bat, which has now been upgraded, but you may need to set your PHPBIN environment var. Also I already have c:\xampp\php in my $PATH.
export PHPBIN=c:/xampp/php/php.exe cd /path/to/mysf2project phpunit.bat -c app |
Now PHPUnit works. Make tests and make them work!
Almost the same steps work for another machine with PHP from Microsoft’s Web Platform Installer.
[…] http://n8v.enteuxis.org/2011/09/phpunit-for-xampp-on-windows-with-cygwin/ […]