-- Jani Hartikainen <[EMAIL PROTECTED]> wrote
(on Thursday, 14 August 2008, 09:05 PM +0300):
> Is it possible to use the request parameters to dispatch
> to a specific controller with Zend_Test? For some reason it
> wouldn't work for me unless I provided an url.
>
> For example:
>
> $this->request->setModuleName('foo');
> $this->request->setControllerName('foo');
> $this->request->setActionName('foo');
> $this->dispatch();
>
> would not work. However, the following:
>
> $this->dispatch('/foo/foo/foo');
>
> worked just fine.
>
> I was wondering if there's something I was doing
> wrong or what could possibly affect the dispatching,
> if it should work with the above set*Name methods too.
>
>
> The reason I wanted to test without the exact url
> is because the url could change depending on the routing,
> but the modules etc. should always stay the same.

Zend_Test still uses the entire dispatch sequence, which includes
routing. Currently, the router overwrites the request with what it
discovers in the environment -- using defaults if nothing is found.

So, this is why your experiment didn't work. This tells me that we need
to perhaps make one or more changes:

 * router and/or routes should not overwrite the
   module/controller/action unless
   actually found

 * modify Zend_Test's dispatch() method to use a null router when no URL
   is provided

These changes should be discussed, however; each has benefits and each
has problems.

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

Reply via email to