Manual setup guide of PHPUnit 3.0.3 for PEARless people
Since I got currently no internet connection at home the PEAR-way of installing PHPUnit is a nope for me. So once again I had to install it manually and spend to much time on this simple task and came up with an quick setup guide. The PHPUnit source is available here.
Step 1:
Start to create two environement variables called PHP_CLI and PHPUNIT_HOME via the system properties(win + break keys). For the environment variable named PHP_CLI you set the path to your PHP executable and for the PHPUNIT_HOME you set the path to where you put the PHPUnit source like C:\php5.2.1\PHPUnit-3.0.3 . I keep it there because I think TDD is a must for serious web development with PHP 5 and therefor a needed core feature.
Step 2:
Rename the pear-phpunit.bat script to phpunit.bat and put it in your path. On my box it's suited in the PHP folder which is already in the path environment variable.
Step 3:
Now open the bat file for editing. Since the manual installation instructions given by Sebastian Bergmann are confusing for me and I never get it running quickly the first time, I came up with an dummy-prove solution. This is were the beforehand defined environement variables are coming in very handy. You just have to add the following line to the bat file and you'r done.
%PHP_CLI% %PHPUNIT_HOME%\PHPUnit\TextUI\Command.php %*Step 4:
At last add the PHPUNIT_HOME directory to your include path in the php.ini. Now fire up your prompt and check for the current version via phpunit --version and you should see the following output.
PHPUnit 3.0.3 by Sebastian Bergmann
Now you are ready to step into TDD with PHP 5.
2 comments:
Thanks so much! I was also struggling to understand the phpunit 'offical' manual install instructs on a winXp box. You cleared it all up extremely well. Tnx again.
Dave
It worked for me with the line
%PHP_CLI% %PHPUNIT_HOME%\phpunit.php %*
in the step 3.
Thanks.
Post a Comment