PHPUnit error with Zend_Session

This post is more than 18 months old. Since technology changes to rapidly, this content may be out of date (but that's not always the case). Please remember to verify any technical or programming information with the current release.

Running a test, I ran into this error:

Zend_Session_Exception: Session must be started before any output has been sent to the browser; output started in /usr/share/php/PHPUnit/Util/Printer.php/173

In order to solve that, I added a line calling ob_start() to my test bootstrap file.

However, there is a better way!!

Instead, add the following line:

Zend_Session::$_unitTestEnabled = true;

This works flawlessly.

Return to All Posts

or use RSS