Run phpunit with the -stderr flag, (newer versions may use --stderr instead) e.g.
phpunit -stderr mytest.php
# or
phpunit --stderr mytest.php
This directs phpunit's output to stderr, preventing it from interrupting HTTP header generation.
It's possible that the test works on your friend's machine because he has output buffering enabled (although I'm not sure if that's relevant in a CLI context).