Bruno --

I sent an email yesterday, but I don't see it in the archives, so I'll
ask again: Can you send both the bootstrap you use, the controller being
tested, and the test case? It's really hard to debug when I don't have
the information needed to reproduce the issue.

I know that Zend_Test works fine with sessions, as the example I
developed for the documentation -- the login form example -- utilizes
Zend_Session, and works. The issue here is likely something to do with
either (a) whitespace appearing before or after a class definition, or
(b) the environment you setup for your application. Both are
correctible.

-- Bruno Friedmann <[EMAIL PROTECTED]> wrote
(on Thursday, 11 September 2008, 06:53 PM +0200):
> Bruno Friedmann wrote:
> > I'm facing a problem how to do this.
> > 
> > I've a application bootstrap which relies on Zend_Session. And I want to 
> > test controllers with the new (not so)
> > Zend_Test_PHPUnit_ControllerTestCase.
> > 
> > It's the first time I've to do this so excuse me for the newb questions.
> > 
> > I've follow the documentation and also the Mathew post blog and wiki.
> > 
> > On a simple "Hello world example " tests are working nicely. (not too 
> > difficult, but just here to prove the env is correctly setup)
> > 
> > So when I launch my test on the complicate bootstrap I've received this 
> > error :
> > 
> > PHPUnit 3.2.21 by Sebastian Bergmann.
> > 
> > IndexControllerTest
> > E
> > 
> > Time: 0 seconds
> > 
> > There were 1 errors:
> > 
> > 1) testIndexAction(IndexControllerTest)
> > Zend_Session_Exception: Session must be started before any output has been 
> > sent to the browser; output started in
> > /usr/share/php5/PEAR/PHPUnit/Util/Printer.php/139
> > /ioda/data/web-include/ZF/library.160/Zend/Session/Namespace.php:116
> > /home/bruno/workspace/socketfinder/sf/ZfApplication.php:155
> > /home/bruno/workspace/socketfinder/sf/ZfApplication.php:118
> > /home/bruno/workspace/socketfinder/sf/ZfApplication.php:98
> > /home/bruno/workspace/socketfinder/sf/tests/Sf/controllers/IndexControllerTest.php:22
> > 
> > I'm pretty sure I would have to do some sort of ouput_buffering but google 
> > was not my friend today.
> > It only give me what phpunit session conference I've missed.
> > 
> > Any path to a solution or any advice are welcome.
> > 
> 
> Ok a little step futher
> I've found that we can change this.
> Zend_Session::$_unitTestEnabled = true;
> 
> but I've always a error ...
> 
> testIndexAction(IndexControllerTest)
> Undefined variable: _SESSION
> /ioda/data/web-include/ZF/library.160/Zend/Session.php:522
> /ioda/data/web-include/ZF/library.160/Zend/Session.php:448
> /ioda/data/web-include/ZF/library.160/Zend/Session/Namespace.php:116
> /home/bruno/workspace/socketfinder/sf/ZfApplication.php:156
> 
> 
> 
> -- 
> 
>      Bruno Friedmann
> 
> 

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to