Where’s the PHPUnit command-line test runner?

Posted on the April 29th, 2013 under Linux,Productivity,Software and Technology by Tohir

After you have installed the PHPUnit via PEAR, how do you get access to the phpunit executable. Here’s the steps from the beginning on Ubuntu.

1) Install PHP Pear if you don’t have it installed

sudo apt-get install php-pear

2) Enable auto discovery

sudo pear config-set auto_discover 1

3) Install PHPUnit via PEAR

sudo pear install pear.phpunit.de/PHPUnit

4) Locate the PHP PEAR bin(ary) directory

 pear config-get bin_dir

Mine shows:

tohir@tohir-MS-7759:~$ pear config-get bin_dir

If you then list the files in that directory, you’ll see:

tohir@tohir-MS-7759:~$ ls /usr/local/zend/bin
apachectl extract_meta_data.sh jqd.sh monitor-node.sh pecl phpize scd setup_sc.sh uninstall.sh zdd.sh ZManifest zs-setup
clean_semaphores.sh gui_passwd.sh lighttpdctl.sh pear php phpunit scd.sh shell_functions.rc watchdog zdpack zmd
create_cert.sh jqd MonitorNode peardev php-config rulemerge setup_jq.sh support_tool.sh zdd zendctl.sh zs-manage

You can then create a symlink to make it easier to access:

sudo ln -s /usr/local/zend/bin/phpunit /usr/bin/phpunit

Leave a Reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>