running phpunit in emacs, elisp

some code for running PHPunit in Emacs

I’m working on a legacy PHP app for a client and up until today I was running unit tests in a terminal window. But my natural working enviornment is Emacs so why not write something that will execute the unit tests and display the results in an Emacs buffer?

The following is the result; it’s fairly short but oh so useful.

The client’s PHP app has been around for 2 years and I was the first one to write any sort of unit tests and to get the unit test infrastructure working. The difference in code quality is huge. There’s nothing like a legacy app with lots of bugs to show you just how important unit testing and regression testing are to maintaining a sane code base!

Click here to read my book review of PHPUnit Essentials.

For all projects where I use Emacs (I do use other IDEs like Intellij and Eclipse), I always try to write functionality in Emacs that improves my productivity. This is just one example. Another example is running the linting tools and deploying code to a remote server.


Leave a Reply and Share Your Thoughts