function test_should_instantiate_controller() { $controller = new RescueController(); $controller->__construct($this->dispatcher); # Dispatching to FooController#index_action won't set a response thus # provoking an error. By calling #render_nothing before dispatching we can # preclude this. $controller->render_nothing(); $this->dispatcher->expectOnce('load_controller', array('foo')); $this->dispatcher->setReturnValue('load_controller', $controller); $this->dispatcher->expectOnce('parse'); $this->dispatcher->setReturnValue('parse', array('foo', '')); $result = $this->dispatcher->dispatch("/foo"); }