Easy way to install PHPUnit
Unit Tests are the living description on how the Unit should work, and ensure that your own Creation is working in that way you wanted to. To write unit test cases in php, I would recommend you to go for PHPUnit. I will tell you an easy way if you are going for a manual installation.
The way of manual installation mentioned in PHPUnit manual is as follows:
- Download a release archive from
http://pear.phpunit.de/get/and extract it to a directory that is listed in theinclude_pathof yourphp.iniconfiguration file. - Prepare the
phpunitscript:- Rename the
pear-phpunitscript tophpunit.
- Replace the
@php_bin@string in it with the path to your PHP command-line interpreter (usually/usr/bin/php).
- Copy it to a directory that is in your
PATHand make it executable (chmod +x phpunit).
- Rename the
I was bit confused while going through above steps as they mentioned :p.
Easy Method (in linux & mac):
- Download a release, extract it (no matter where). And find the
phpunit.phpinside the extracted folder. - In terminal, change directory to
/usr/binthen create symbolic link tophpunit.phpand name it phpunit.In case you don't know here is the syntax,
sudo ln -s <absolute_path-to-phpunit.php> phpunit
Happy coding!
