Web Development

How do we install PHPUnit Again?

Before, I installed the older version of PHPUnit, the one with PHP version less than 5.3, where there is only one package required by just copying them into the PHP include directory and set up the phpunit executable. This time, I’ve upgraded to the latest and the greatest using the easiest way.

Installing via PEAR

This is how I install my latest PHPUnit with PHP 5.3.8 on my local machine (Slackware Linux).

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install phpunit/PHPUnit

I did this as root. Below is the actual transcript.

root@darkstar:~# pear channel-discover pear.phpunit.de
Channel "pear.phpunit.de" is already initialized
root@darkstar:~# pear channel-discover components.ez.no
Adding Channel "components.ez.no" succeeded
Discovery of channel "components.ez.no" succeeded
root@darkstar:~# pear channel-discover pear.symfony-project.com
Adding Channel "pear.symfony-project.com" succeeded
Discovery of channel "pear.symfony-project.com" succeeded
root@darkstar:~# pear install phpunit/PHPUnit      
Did not download optional dependencies: phpunit/PHP_Invoker, use --alldeps to download automatically
phpunit/PHPUnit can optionally use package "phpunit/PHP_Invoker" (version >= 1.0.0)
phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2.0.5)
downloading PHPUnit-3.6.7.tgz ...                  
Starting to download PHPUnit-3.6.7.tgz (118,349 bytes)
.....done: 118,349 bytes                           
downloading File_Iterator-1.3.1.tgz ...            
Starting to download File_Iterator-1.3.1.tgz (5,157 bytes)
...done: 5,157 bytes                               
downloading Text_Template-1.1.1.tgz ...            
Starting to download Text_Template-1.1.1.tgz (3,622 bytes)
...done: 3,622 bytes                               
downloading PHP_CodeCoverage-1.1.1.tgz ...
Starting to download PHP_CodeCoverage-1.1.1.tgz (132,339 bytes)
...done: 132,339 bytes
downloading PHP_Timer-1.0.2.tgz ...
Starting to download PHP_Timer-1.0.2.tgz (3,686 bytes)
...done: 3,686 bytes
downloading PHPUnit_MockObject-1.1.0.tgz ...
Starting to download PHPUnit_MockObject-1.1.0.tgz (19,688 bytes)
...done: 19,688 bytes
downloading YAML-1.0.6.tgz ...
Starting to download YAML-1.0.6.tgz (10,010 bytes)
...done: 10,010 bytes
downloading PHP_TokenStream-1.1.2.tgz ...
Starting to download PHP_TokenStream-1.1.2.tgz (9,797 bytes)
...done: 9,797 bytes
install ok: channel://pear.phpunit.de/File_Iterator-1.3.1
install ok: channel://pear.phpunit.de/Text_Template-1.1.1
install ok: channel://pear.phpunit.de/PHP_Timer-1.0.2
install ok: channel://pear.symfony-project.com/YAML-1.0.6
install ok: channel://pear.phpunit.de/PHP_TokenStream-1.1.2
install ok: channel://pear.phpunit.de/PHP_CodeCoverage-1.1.1
install ok: channel://pear.phpunit.de/PHPUnit_MockObject-1.1.0
install ok: channel://pear.phpunit.de/PHPUnit-3.6.7
root@darkstar:~# phpunit --version
PHPUnit 3.6.7 by Sebastian Bergmann.

root@darkstar:~#

Enjoy PHPUnit!

Leave a reply

Your email address will not be published. Required fields are marked *