/** * addRoute(): defined by RouteStackInterface interface. * * @see RouteStackInterface::addRoute() * @param string $name * @param mixed $route * @param int $priority * @return SimpleRouteStack */ public function addRoute($name, $route, $priority = null) { if (!$route instanceof RouteInterface) { $route = $this->routeFromArray($route); } return parent::addRoute($name, $route, $priority); }
public function setUp() { $this->form = new Form(); $this->collection = new Collection('links', ['count' => 1, 'allow_add' => true, 'target_element' => ['type' => TestAsset\LinksFieldset::class]]); $router = new SimpleRouteStack(); $router->addRoute('home', LiteralRoute::factory(['route' => '/', 'defaults' => ['controller' => TestAsset\SampleController::class]])); $router->addRoute('sub', SegmentRoute::factory(['route' => '/foo/:param', 'defaults' => ['param' => 1]])); $router->addRoute('ctl', SegmentRoute::factory(['route' => '/ctl/:controller', 'defaults' => ['__NAMESPACE__' => 'ZendTest\\Mvc\\Controller\\TestAsset']])); $this->controller = new TestAsset\SampleController(); $this->request = new Request(); $this->event = new MvcEvent(); $this->routeMatch = new RouteMatch(['controller' => 'controller-sample', 'action' => 'postPage']); $this->event->setRequest($this->request); $this->event->setRouteMatch($this->routeMatch); $this->event->setRouter($router); $this->controller->setEvent($this->event); $this->plugin = new FilePostRedirectGet(); $this->plugin->setController($this->controller); }