Functional test problem

I am trying to write a functional test where the user should be authenticated. So I tried to create the identity, authenticate it than logging in that user. Everything goes fine until the login part but I got a header already sent error when Yii tries to regenerate the session ID. I checked all my files and there wasn’t any output before this point. To make it sure I generated a fresh app and just added a test to the auto generated SiteTest class. It was the same. So I added a session_start() function call to see where the is output coming from. My output was the following:


headers already sent by (output started at /usr/share/pear/PHPUnit/Util/Printer.php:173)

So I dig in the code and I realized everything caused by PHPUnit’s output. I understand I can have my own “Printer” class with which I can avoid such a behaviour but because I never used PHPUnit before (and it is a bit hard to believe I am the first who experience this problem) I am wondering maybe I don’t know about some setting with which I can fix this.

Any ideas?

I solved it. Just need to run PHPUnit with --stderr flag and it works like I expected. Hope it helps to others as well.