When testing stuff with Ecomdev_PHPUnit the following error could occur:
Exception: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at [...]/vendor/phpunit/phpunit/src/Util/Printer.php:172) in [...]/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 123
This error happens because somewhere in your tested code there is an itialization to a Magento's session singleton/model that casues a session_start
which in turn needs to set the related cookie/session header. The error is thrown because the output has already started due to PHPUnit initial output.
The architecture of these Magento models sucks and there is no separation between domain session logic and PHP session_*
functions but fortunately we can mock session calls through Ecomdev_PHPUnit.