Installing PHPUnit manually for CakePHP 2.0

Posted November 11th, 2011 • 2 min read

I was trying to get into Unit Testing a few months ago. It was a steep learning curve and eventually I gave myself a non-excuse and decided to wait for Cake 2.0 as that would have PHPUnit and it "wouldn't make sense to learn SimpleTest" at that time.

I intend to keep that promise and have been trying to get into Unit Testing for real this time. The first thing was also the most annoying so far: installing the (&#(&. After completely messing up my local PEAR environment I gave up on the "official way" and wrote a PHPUnit Installer Shell to install PHPUnit along with the Cake site.

PHPUnit locally?

Yes! I'm a fan of self-contained systems. Sure, installing PHPUnit through PEAR should provide a systemwide tool, but when you're working on multiple workstations and deploy to different hosting setups it's just nice to know you have everything within reach. Besides, my MAMP setup on OSX Lion didn't play nice with PEAR at all so enough excuses to write an installer shell.

What it does

It's quite simple really, it downloads all the files and folders that PHPUnit needs, makes them into a nice package and moves them into the app folder, ready for you to play with!

How do I get it

I just pushed it to Github: Get the installer Shell here

The README there provides you with the rest of the information.

I'll post some updates on my journey when I can, meanwhile: If you have any optimialisations, ideas on Unit Testing in general or some good pointers .. let me know!

Stay up to date

Want to know when a new post comes out and stay in the loop on tips, tricks and gotchas? Consider signing up for the Mindthecode newsletter.

Comments

Keep reading

April 27th, 2020 • 35 min read
Exploring the options we have as developers to retrieve a large dataset. We will go through the process of finding the data we need, and then write the code to make that date ours in a format we can use.
July 10th, 2011 • 1 min read
Let me show you how you can use Markdown within your next CakePHP project
May 5th, 2014 • 11 min read
Today I want to show a generic workflow and setup I have used a lot lately when working on building apps with Angular. It uses Gulp as a CI system and Browserify to minimize code clutter and maximize awesomeness.