Ubuntu 14.04, CakePHP 2.4 and PHPUnit 3.7

I've been in the process of migrating all of my servers from Ubuntu 12.04 over to Ubuntu 14.04. For this process, I'll usually install the OS on a VM (virtual machine) and document my build of the LAMP (Linux, Apache, MySQL, PHP) stack. Once I am satisfied I have worked out most of the details for getting the new LAMP stack up and running, I'll begin installing and testing my website. For me, the process begins with running unit tests. jasonsnider.com is built on top of the latest CakePHP 2.x build which means I'm using PHPUnit 3.7 for testing. In would install PHPUnit using pear and be done with it, but for whatever reason, that approach is not working for me. I have spent more time than I care to admit trying to get this working. PHPUnit would install correctly, but CakePHP just wouldn't see it. After many failed attempts using apt-get, phar, composer and pear I finally got the two pieces of software to play nice together. I downloaded the source code for PHPUnit 3.7 and each of its dependencies from https://github.com/sebastianbergmann and manually built the package. For anyone running into this problem you can download the package I built or you can install via the command line.

cd ~/Downloads wget https://jasonsnider.com/files/phpunit-patched.tar.gz tar -zxvf phpunit-patched.tar.gz sudo mv phpunit-patched /usr/share/phpunit

Once you have the package be sure to add the following path to your php.ini files. Replace "vim" with your editor of choice.

sudo vim /etc/php5/apache2/php.ini sudo vim /etc/php5/cli/php.ini include_path = ".:/usr/share/phpunit:/usr/share/phpunit/PHPUnit"


LinkedInGitHubTwitter