-- Jeace <[email protected]> wrote
(on Thursday, 13 January 2011, 08:42 AM -0800):
> > >But this is what happens during a normal request. Additionally, there's
> > >a bit more logic that happens in the ControllerTestCase::setUp() method
> > >that, if skipped, will cause issues -- it ensures that singletons are
> > >reset, the request and response reset, etc.
> 
> Actually, I don't call parent::setUp() method because there is one resource
> i don't want to bootstrap. This resource sets up the locale from the browser
> locale which doesn't exist in PHPUnit context.

There are ways to avoid that, while still maintaining a normal workflow
within ControllerTestCase.

 * Create a specific configuration environment for testing that doesn't
   include that resource. One way to accomplish this is to create a
   "base" or "default" environment that has most production settings,
   and then have the "production" setting inherit from that, and add the
   locale resource.

   This approach also lets you specify a "replacement" resource, in case
   you need the resource, but want to configure it specifically for
   testing purposes.

 * Create a decorator for the base Locale resource that does checks on
   the environment in order to determine how to act. Doing this allows
   you to use the same resource regardless of environment.

I'd try one of these approaches, and then modify your test case to do
the recommended workflow.

> > >What does the backtrace provide? If you're not getting a backtrace,
> > >install and enable xdebug so you can get one. 
> >  
> > >Also, what version of PHPUnit and PHP are you using?
> > 
> 
> I'm using PHP 5.3.3 and PHPUnit 5.3.0.

There is no PHPUnit 5.3 -- maybe you mean 3.5? For a ZF1 application,
I'd recommend using a 3.4-series PHPUnit until we've ironed out 3.5
compatibility.

> I will install Xdebug and let you know about the backtrace later

-- 
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

Reply via email to