public function setUp() { $router = new TreeRouteStack(); $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\\Plugin\\Prg\\TestAsset', 'controller' => 'sample']])); $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 PostRedirectGet(); $this->plugin->setController($this->controller); }
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); }