How to install Pear and PHPUnit on Linux


PHPUnit is a unit testing framework for the PHP programming language.It allows PHP programmers to perform unit testing, and practice test-driven development.By using PHPUnit you can detect your code mistakes, the quicker you can fix them. Like all Unit testingframeworks PHPUnit uses assertions to verify that behaviour of the unit of code under test behaves as expected.

First, we need to install pear through the following command:

sudo wget
php go-pear.phar
sudo apt-get install wget

then run:

sudo apt-get install php-pear

You need to set following configurations:

sudo pear config-set bin_dir /usr/bin
sudo pear config-set doc_dir /usr/share/php/doc
sudo pear config-set php_dir /usr/share/php
sudo pear config-set cfg_dir /usr/share/php/cfg
sudo pear config-set data_dir /usr/share/php/data
sudo pear config-set test_dir /usr/share/php/test

Install the dependencies using PEAR package.

sudo pear channel-discover
sudo pear channel-discover
sudo pear channel-discover
sudo pear install phpunit/PHPUnit

Confirm the version of PHPUnit.

phpunit --version
PHPUnit 4.0.17 by Sebastian Bergmann.

Thats it.

Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkedin
Share On Pinterest

Be the first to comment

Leave a Reply

Your email address will not be published.