Running CakePHP Unit Tests with TextMate

As most people know TextMate is a pretty amazing text editor, probably one of the best for MacOS. What you may not know is that CakePHP has its own textmate bundle. this bundle is maintained by Joël Perras who is also a recent addition to the CakePHP core team. Joël & Andy Dawson have been working on another project called CakeMate CakeMate is described as

A plugin used to extend the functionality of the CakePHP TextMate bundle, which can be found on “The Chaw”: This plugin is designed to work in conjunction with the Textmate bundle, and will not work as a standalone.

Sounds pretty cool eh? Well it is. If you write and run unit tests all day CakeMate might help reduce all the cmd+tab, cmd+r you are doing. CakeMate is still a work in progress, but the testing shell works. I spent a few hours on the weekend updating the output to make it prettier and easier to read. You can find those in my fork of CakeMate and hopefully in the main fork as well.

Using CakeMate to run tests

So in order to run unit tests using CakeMate you need to download and place it in your app/plugins directory, or otherwise link it up Once that is done, you need to create a command in TextMate so you can run the CakeMate tester shell. Mine looks like

Show Plain Text
  1. #!/bin/sh
  2. $TM_PROJECT_DIRECTORY/cake/console/cake cakemate tester -working $TM_PROJECT_DIRECTORY

You’ll want to set the input as “None”, and the output as “Show as Html” I’ve bound this to command to cmd+ctrl+r. Once you’ve added the command, anytime you have a test case as the active document, you can hit your command and run the test. You should get a popup that looks a little like this

CakeMate sample results

No more having to leave textmate to run unit tests which is really nice.


Lovin’ the colors & javascript love, Mark. Most awesome.

I’ve merged your fork commits into the CakeMate main repository.

For general information, as soon as the CakeMate plugin stabilizes a bit, there will be an update to the CakePHP.tmbundle (the CakePHP Textmate bundle) which will include the above Textmate Command that Mark has described, as well as a few others. This will provide a more cohesive link between the plugin and the bundle, and will also facilitate the writing of Textmate commands/extensions/etc. using the functionality that CakePHP shells provide.

Watch the CakeMate repository to follow the development (or – even better – fork it & help out!).

Joel Perras on 3/9/09

Really nice! I will have a look and try to help out here. Thnx!

primeminister on 3/9/09

Mark – just found this old article. Are there any newer alternatives to these? If not, do you think it’s worth it to have something like this for 2.x?


David Kullmann on 3/21/12

Comments are not open at this time.