The less horrible way, in my opinion, would be the to use xdebug, as mentioned here: http://www.santiagolizardo.com/article/testing-if-http-headers-were-sent-in-php-and-phpunit/78002