Making guard-phpunit2 Realtime

I’ve been using guard and
guard-phpunit2 for unit testing PHP
code at work. (Hey, at least there are tests)

One of my main difficulties with it is that it did not show output in
real-time. It ships with a really nice rspec inspired result printer, but
unfortunately during a run of a large test-suite you can’t see any output until
the entire thing is done.

guard-phpunit2 works by shelling out to phpunit and then parsing the subprocess’s output.
This has the unfortunate side-effect of swallowing all of phpunit’s progress
output until complete.

Real time output requires a different algorithm. Luckily,
PHPUnit provides a few different logging options.
Using --log-json file.json will write an event log of every test to
file.json. Guard can then pick up that file and parse it, completely
ignoring phpunit‘s STDOUT.

I forked the project and replaced the output parsing logic with a new parser
that can process the --log-json file.