-- jasonswett <[email protected]> wrote
(on Monday, 12 January 2009, 08:20 AM -0800):
> 
> I'm using ZF 1.6.0 and I'm trying to get Zend_Test_PHPUnit_ControllerTestCase
> to work. I've mostly gotten it, but when I try to call dispatch(), I get the
> following error:
> 
> Zend_Controller_Dispatcher_Exception: Invalid controller specified (error)
> 
> Here's what my code looks like:
> 
> class UserControllerTest extends Zend_Test_PHPUnit_ControllerTestCase
> {
>     public function setUp()
>     {   
>         $this->bootstrap = array($this, 'appBootstrap');
>         parent::setUp();
>     }   
> 
>     public function appBootstrap() {
>         $this->frontController->registerPlugin(new Initializer('test'));
>     }   
> 
>     public function testWhatever()
>     {   
>         $this->dispatch('connector/index');

Use a leading slash:

    $this->dispatch('/connector/index');

dispatch() is passing the argument as a URL to the request object, so it
should look like a URL (though it doesn't require the schema, hostname
and/or port).

>     }   
> }
> 
> I guess when it says "Invalid controller specified (error)," it thinks that
> I'm trying to run a controller called "error." Even if my controller dir
> isn't set properly, why would it get the controller name wrong?
> 
> Also, does anyone know where I can find some good, complete examples using
> Zend_Test_PHPUnit_ControllerTestCase?
> 
> Thanks,
> Jason
> -- 
> View this message in context: 
> http://www.nabble.com/Zend_Controller_Dispatcher_Exception%3A-Invalid-controller-specified-%28error%29-tp21417721p21417721.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 

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

Reply via email to