The problem is that you have the code, perhaps deep in the structure you are using, which calls session_start() . This, in turn, wants to send a cookie. But PHPUnit has already started writing output to stdout.
The key to understanding here is that it is just a unit test, no one cares about the header. So just suppress the error message. And the way you do this, without changing the system test, is to call session_start () in your own unit test (before parent::setUp() or inside this setUp function). And use the @ prefix to suppress errors. eg.
function setUp(){ @session_start(); parent::setUp(); ... }
Darren cook
source share