Friday, April 16, 2010

PHP, PHPUnit, Selenium and NetBeans IDE

Installing Pear
1. Go to the \bin\php\phpX.X.X directory
2. Run the following command
php.exe -d phar.require_hash=0 PEAR/go-pear.phar
3. And then open php.ini, find the key "error_reporting". Set it as below
error_reporting = E_ALL & ~E_DEPRECATED
4. Restart all servers in wamp

Installing PHPUnit
1. Go to the \bin\php\phpX.X.X directory
2. Run the following command
aptitude install phpunit
3. Then the following
aptitude install php-pear
4. Then the following...
pear install phpunit/PHPUnit
5. If you are getting an error as “No valid packages found Install failed” then run the following command
pear upgrade-all
6. Upon successful completion of Step 5, re-run the command in Step 5

If you are not able to create PHPUnit tests via “Create PHPUnit tests” please follow the below steps.

1. Go to the \bin\php\phpX.X.X directory
2. Edit phpunit.bat
3. Verify “set PHPBIN” value. Provide the exact location of php.exe file.
Example: If php.exe and phpunit.bat are in the same directory and if the phpunit.bat shows as set PHPBIN=".\php.exe", it should be corrected as set PHPBIN="php.exe"
4. Verify the value of %PHPBIN% and correct it as required

Installing Selenium in NetBeans IDE
1. Go to the \bin\php\phpX.X.X directory
2. Run the following command
pear install Testing_Selenium-beta
3. Open IDE and go to Tools -> Plugins
4. Install Selenium Module for PHP


Ref by Bhagya's blog