> This was due to the view accessing some uninitialised array variable. Normally
> in a browser you would probably see some warning messages but, somehow, using
> Zend Test that tiny error caused the ErrorControlller to take the place of the
> original controller. Weird, but at least I got it solved.
> On Fri, Jan 2, 2009 at 6:03 PM, Chee How <
[hidden email]> wrote:
>
>
> I've done some more testing and discovered something very strange.
>
> What I did was to create a new controller and view to test the dispatch. It
> works fine on this new controller.
>
> I then removed the problematic controller and changed the name of the new
> controller to that of the problematic one (in this case, it is
> "DashboardController").
>
> Strangely enough, it works. The only reason I can think of is that there is
> something wrong with the code that causes
>
> I've also found out that the reason why the original problematic controller
> couldn't dispatch properly is due to the ErrorController being called to
> handle an error. I can't imagine what kind of error that would be because
> everything works fine when I use the browser, but not with Zend_Test.
>
> Can anyone point out where the problem might be? I suspect it is due to the
> loading of the model classes but I've got to do more testing to find out.
>
>
> Chee How wrote:
> >
> > Hi,
> >
> > I'm just starting to use PHPUnit test and Zend_Test.
> >
> > I've managed to get both running with my application but I'm facing a
> > strange problem. The dispatching does not seem to be able to dispatch my
> > requests to any other controller except IndexController and
> > ErrorController.
> >
> > I'll try to explain as clearly as possible as my application setup is
> > rather
> > convoluted.
> >
> > I'm using a modular approach to developing my application. This is done
> > with
> > the following line in /application/bootstrap.php:
> >
> > $frontController->addModuleDirectory(APPLICATION_PATH . '/modules');
> >
> > Right now, there are no additional modules yet, only the default.
> >
> > In my test, I created a MainControllerTest.php in /tests/
> > Aside from the normal setUp() and tearDown() methods, I have just one
> > testRedirectionToDashboard() method in this class. This method is defined
> > like this:
> >
> > public function testRedirectionToDashboard()
> > {
> > $this->dispatch('/');
> > $this->assertController('index');
> > }
> >
> > The above runs fine. Even if I change
> > $this->dispatch('/')
> > to
> > $this->dispatch('/index/look');
> > it works fine.
> >
> > The problem occurs when I change the location to any controller other
> than
> > index. So
> >
> > $this->dispatch('/dashboard');
> > $this->assertController('dashboard');
> >
> > will fail.
> >
> > I have no idea why this is the case and I've tried everything I can think
> > of. I guess it probably is something fundamental that has to do with the
> > front controller but I'm new to PHPUnit and Zend_Test, and can't figure
> > this
> > out by myself.
> >
> > Any help is appreciated. Thanks.
> >
> > I've deliberately kept this message small for easier reading. If more
> > information is needed, I can place it in follow-up posts. Thanks.
> >
> >
>
> --
> View this message in context:
http://www.nabble.com/> Problem-with-Dispatch-using-Zend_Test-tp21227742p21249609.html
> Sent from the Zend Core mailing list archive at Nabble.com.
>
>
>