在PHPUnit中,如何防止发送标头

I have a test suite in PHPUnit. Some of the tests work with session (regenerate id, start etc). Those tests fails as PHPUnit already echoed something.

I am not really testing what are the headers. Is there a way to prevent headers from being sent in PHP? This is a CLI PHP, not a web server php module.

(The solution I will implement if no other possibility is to build my own "fake" session handler for the unit tests purposes, aka DI, but I rather play with the real session if possible).