Categories: Software Development

some code for running PHPunit in Emacs

running phpunit in emacs, elisp

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.

[gist 8981483]

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.

Rudolf Olah is a software development expert with over 8 years of professional software developer experience. He has produced the video courses "Reactive Programming in Python with RxPy, PyQt5 and Tornado" and "Learning AngularJS Testing" for PacktPublishing. Rudolf offers web development training courses for individual developers and for web development teams. He writes about tech leadership, career coaching and project management.