Beispiel #1
0
 public function testPluginWithoutControllerLocatorRaisesDomainException()
 {
     $controller = new SampleController();
     $plugin = $controller->plugin('forward');
     $this->setExpectedException('Zend\\Mvc\\Exception\\DomainException', 'composes Locator');
     $plugin->dispatch('forward');
 }
Beispiel #2
0
 public function testPluginWithoutRouterInEventRaisesDomainException()
 {
     $controller = new SampleController();
     $event      = new MvcEvent();
     $controller->setEvent($event);
     $plugin = $controller->plugin('url');
     $this->setExpectedException('Zend\Mvc\Exception\DomainException', 'event compose a router');
     $plugin->fromRoute('home');
 }
Beispiel #3
0
 public function testRedirectToRouteWithoutRouterInEventRaisesDomainException()
 {
     $controller = new SampleController();
     $event = new MvcEvent();
     $event->setResponse($this->response);
     $controller->setEvent($event);
     $plugin = $controller->plugin('redirect');
     $this->setExpectedException('Zend\\Mvc\\Exception\\DomainException', 'event compose a router');
     $plugin->toRoute('home');
 }
Beispiel #4
0
 public function testRemovesModuleRouteListenerParamsWhenReusingMatchedParameters()
 {
     $router = new \Zend\Mvc\Router\Http\TreeRouteStack();
     $router->addRoute('default', array('type' => 'Zend\\Mvc\\Router\\Http\\Segment', 'options' => array('route' => '/:controller/:action', 'defaults' => array(ModuleRouteListener::MODULE_NAMESPACE => 'ZendTest\\Mvc\\Controller\\TestAsset', 'controller' => 'SampleController', 'action' => 'Dash')), 'child_routes' => array('wildcard' => array('type' => 'Zend\\Mvc\\Router\\Http\\Wildcard', 'options' => array('param_delimiter' => '=', 'key_value_delimiter' => '%')))));
     $routeMatch = new RouteMatch(array(ModuleRouteListener::MODULE_NAMESPACE => 'ZendTest\\Mvc\\Controller\\TestAsset', 'controller' => 'Rainbow'));
     $routeMatch->setMatchedRouteName('default/wildcard');
     $event = new MvcEvent();
     $event->setRouter($router)->setRouteMatch($routeMatch);
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->onRoute($event);
     $controller = new SampleController();
     $controller->setEvent($event);
     $url = $controller->plugin('url')->fromRoute('default/wildcard', array('Twenty' => 'Cooler'), true);
     $this->assertEquals('/Rainbow/Dash=Twenty%Cooler', $url);
 }
Beispiel #5
0
 public function testPluginWithoutControllerLocatorRaisesServiceNotCreatedException()
 {
     $controller = new SampleController();
     $this->setExpectedException('Zend\\ServiceManager\\Exception\\ServiceNotCreatedException');
     $plugin = $controller->plugin('forward');
 }