The issue I noticed many people have with PHPUnit is that it will not behave nicely when working with session data like sending headers and such. There are lots of posts on the internet about calling session_start() from a bootstrap before running each test, and that certainly is a good start. However, that doesn't help when a call to header() stops the test because it doesn't work.
Solution:
Using PHP runkit, we can change the functionality of the header function - as well as any other function - at runtime. This way you can print out the header to the console during testing. I added a function called myecho (echo and print are not functions so you will have to write a wrapper) and used runkit_function_remove to get rid of header, and runkit_function_copy to put myecho in its place.
The runkit framework is really useful for mocking built-in functions and other things. After playing with runkit I also found a lesser used strategy which is to redefine functions within your namespace and use the namespace separator ( \ ) operator to access things from the global scope in php 5.3. If you are on an earlier version you might as well use runkit. I read about it here: http://www.dhmedia.com.au/blogs/php5s-new-namespace-separator-backslash
Extra:
Testing applications such as RESTful services that rely on headers to send accept/content-type fields is difficult under PHPUnit since you can't just clear your session and start again during tests within a single test class. In my framework I made a test class for each mime type that I would support, namely xml, json, and plain text. For example, I would have a GetRequestTestXML and a GetRequestTestJSON class. This way the bootstrap gets loaded for each time I want to set session data like header content-types.