Search This Blog

Showing posts with label unittest. Show all posts
Showing posts with label unittest. Show all posts

Monday, May 2, 2011

Setting up phpunit in ubuntu



  1. Install PEAR . Issue the command sudo apt-get install php-pear.
  2. Make sure PEAR is up to date. Issue the command sudo pear channel-update pear.php.net. 
  3. Upgrade the PEAR elements. Issue the command sudo pear upgrade-all.
  4. Tell PEAR where to find the PHPUnit code. Issue the command sudo pear channel-discover pear.phpunit.de
  5. Install PHPUnit. Issue the command sudo pear install -a phpunit/PHPUnit. The -a makes sure all dependency packages are also installed.
  6. Issue the command phpunit --version. You should have version 3.3.17 or newer installed.
  7. Install XDebug. Issue the command sudo apt-get install php5-xdebug. This is needed if you want the HTML based coverage reports. 
  8. Restart the web server after installing this package. (sudo /etc/init.d/apache restart ).
reference 

Tuesday, October 26, 2010

How to run a single PHP Unit Test

How to run a single PHP Unit Test

phpunit --filter EmpSalaryReportTest AllTests.php

// Get unit test coverage report

phpunit --coverage-html ./report BankAccountTest

phpunit --coverage-html AllTests AllTests.php