How can I pass extra parameters to the routeMatch object?

tmclean20

New Member
I'm trying to unit test a controller, but can't figure out how to pass some extra parameters to the routeMatch object.I followed the posts from tomoram at http://devblog.x2k.co.uk/unit-testing-a-zend-framework-2-controller/ and http://devblog.x2k.co.uk/getting-th...he-test-environment-and-dependency-injection/, but when I try to dispatch a request to /album/edit/1, for instance, it throws the following exception:\[code\]Zend\Mvc\Exception\DomainException: Url plugin requires that controller event compose a router; none found\[/code\]The code for the test:\[code\]public function testEditActionWithGetRequest(){ // Dispatch the edit action $this->routeMatch->setParam('action', 'edit'); $this->routeMatch->setParam('id', $album->id); $result = $this->controller->dispatch($this->request, $this->response); // rest of the code isn't executed}\[/code\]I'm not sure what I'm missing here. Can it be any configuration for the testing bootstrap? Or should I pass the parameters in some other way? Or am I forgetting to instantiate something?
 
Top