Sunday, July 24, 2011

Installing PHPUnit for use in Windows NetBeans

I initially used NetBeans Guide to get PHPUnit installed in NetBeans but here is a quick install checklist for use with PHP 5.2. These are mostly workarounds I had to do for 5.2.17, that work as of this post, but may not work in the future.

For details on how to use it see NetBeans Guide.
  1. Install NetBeans
  2. PHP 5.2 w/ the following extensions
    Curl
    At least one of the PDO extensions
  3. Run go-pear.bat located in the PHP directory
  4. Run the PEAR_ENV.reg it creates
  5. from the cmd line run "pear upgrade pear"
  6. Modify pear.bat add a semi-colon to include_path="%PHP_PEAR_INSTALL_DIR%" so that it becomes include_path=";%PHP_PEAR_INSTALL_DIR%" This will prevent you from getting an "Invalid configuration directive" error every time you run pear.
  7. run "pear install channel://pear.php.net/Net_URL2-0.3.1"
  8. run "pear install channel://pear.php.net/HTTP_Request2-2.0.0RC1"
  9. Follow the PHPUnit Install Guide to install PHPUnit
If you get any errors like "Failed to download pear/Net_URL2 within preferred state "stable", latest release is version 0.3.1, stability "beta", use "channel://pear.php.net/Net_URL2-0.3.1" to install" Just run "pear channel://WHATEVER_CHANNEL_IT_TOLD_YOU_TO_USE". In this example you would run "pear install channel://pear.php.net/Net_URL2-0.3.1".

If after following the PHPUnit Install Guide you get the message

No releases available for package "pear.phpunit.de/PHPUnit"

try running pear update-channels and then pear clear-cache

No comments: