/** * @return void */ public function setUp() { parent::setUp(); $route = new Route(); $route->setName('Functional Test - Http::Client::InternalRequestEngine'); $route->setUriPattern('test/security/restricted'); $route->setDefaults(['@package' => 'Neos.Flow', '@subpackage' => 'Tests\\Functional\\Security\\Fixtures', '@controller' => 'Restricted', '@action' => 'admin', '@format' => 'html']); $this->router->addRoute($route); }
/** * @return void */ public function setUp() { parent::setUp(); $route = new Route(); $route->setName('Functional Test - Session::SessionTest'); $route->setUriPattern('test/session(/{@action})'); $route->setDefaults(['@package' => 'Neos.Flow', '@subpackage' => 'Tests\\Functional\\Session\\Fixtures', '@controller' => 'SessionTest', '@action' => 'sessionStart', '@format' => 'html']); $this->router->addRoute($route); }
/** * Additional setup: Routes */ public function setUp() { parent::setUp(); $route = new Route(); $route->setName('WidgetTest'); $route->setUriPattern('test/widget/{@controller}(/{@action})'); $route->setDefaults(array('@package' => 'Neos.FluidAdaptor', '@subpackage' => 'Tests\\Functional\\Core\\Fixtures', '@action' => 'index', '@format' => 'html')); $route->setAppendExceedingArguments(true); $this->router->addRoute($route); }
/** * Additional setup: Routes */ public function setUp() { parent::setUp(); $route = new Route(); $route->setName('AbstractControllerTest Route 1'); $route->setUriPattern('test/mvc/abstractcontrollertesta/{@action}'); $route->setDefaults(['@package' => 'Neos.Flow', '@subpackage' => 'Tests\\Functional\\Mvc\\Fixtures', '@controller' => 'AbstractControllerTestA', '@format' => 'html']); $route->setAppendExceedingArguments(true); $this->router->addRoute($route); }
/** * @return void */ public function setUp() { parent::setUp(); $accountRepository = $this->objectManager->get(AccountRepository::class); $accountFactory = $this->objectManager->get(AccountFactory::class); $account = $accountFactory->createAccountWithPassword('functional_test_account', 'a_very_secure_long_password', ['Neos.Flow:Administrator'], 'TestingProvider'); $accountRepository->add($account); $account2 = $accountFactory->createAccountWithPassword('functional_test_account', 'a_very_secure_long_password', ['Neos.Flow:Administrator'], 'HttpBasicTestingProvider'); $accountRepository->add($account2); $account3 = $accountFactory->createAccountWithPassword('functional_test_account', 'a_very_secure_long_password', ['Neos.Flow:Administrator'], 'UsernamePasswordTestingProvider'); $accountRepository->add($account3); $this->persistenceManager->persistAll(); $route = new Route(); $route->setName('Functional Test - Security::Restricted'); $route->setUriPattern('test/security/restricted(/{@action})'); $route->setDefaults(['@package' => 'Neos.Flow', '@subpackage' => 'Tests\\Functional\\Security\\Fixtures', '@controller' => 'Restricted', '@action' => 'public', '@format' => 'html']); $route->setAppendExceedingArguments(true); $this->router->addRoute($route); $route2 = new Route(); $route2->setName('Functional Test - Security::Authentication'); $route2->setUriPattern('test/security/authentication(/{@action})'); $route2->setDefaults(['@package' => 'Neos.Flow', '@subpackage' => 'Tests\\Functional\\Security\\Fixtures', '@controller' => 'Authentication', '@action' => 'authenticate', '@format' => 'html']); $route2->setAppendExceedingArguments(true); $this->router->addRoute($route2); $route3 = new Route(); $route3->setName('Functional Test - Security::HttpBasicAuthentication'); $route3->setUriPattern('test/security/authentication/httpbasic(/{@action})'); $route3->setDefaults(['@package' => 'Neos.Flow', '@subpackage' => 'Tests\\Functional\\Security\\Fixtures', '@controller' => 'HttpBasicTest', '@action' => 'authenticate', '@format' => 'html']); $route3->setAppendExceedingArguments(true); $this->router->addRoute($route3); $route4 = new Route(); $route4->setName('Functional Test - Security::UsernamePasswordAuthentication'); $route4->setUriPattern('test/security/authentication/usernamepassword(/{@action})'); $route4->setDefaults(['@package' => 'Neos.Flow', '@subpackage' => 'Tests\\Functional\\Security\\Fixtures', '@controller' => 'UsernamePasswordTest', '@action' => 'authenticate', '@format' => 'html']); $route4->setAppendExceedingArguments(true); $this->router->addRoute($route4); }
/** * Creates \Neos\Flow\Mvc\Routing\Route objects from the injected routes * configuration. * * @return void * @throws InvalidRouteSetupException */ protected function createRoutesFromConfiguration() { if ($this->routesCreated === true) { return; } $this->initializeRoutesConfiguration(); $this->routes = []; $routesWithHttpMethodConstraints = []; foreach ($this->routesConfiguration as $routeConfiguration) { $route = new Route(); if (isset($routeConfiguration['name'])) { $route->setName($routeConfiguration['name']); } $uriPattern = $routeConfiguration['uriPattern']; $route->setUriPattern($uriPattern); if (isset($routeConfiguration['defaults'])) { $route->setDefaults($routeConfiguration['defaults']); } if (isset($routeConfiguration['routeParts'])) { $route->setRoutePartsConfiguration($routeConfiguration['routeParts']); } if (isset($routeConfiguration['toLowerCase'])) { $route->setLowerCase($routeConfiguration['toLowerCase']); } if (isset($routeConfiguration['appendExceedingArguments'])) { $route->setAppendExceedingArguments($routeConfiguration['appendExceedingArguments']); } if (isset($routeConfiguration['httpMethods'])) { if (isset($routesWithHttpMethodConstraints[$uriPattern]) && $routesWithHttpMethodConstraints[$uriPattern] === false) { throw new InvalidRouteSetupException(sprintf('There are multiple routes with the uriPattern "%s" and "httpMethods" option set. Please specify accepted HTTP methods for all of these, or adjust the uriPattern', $uriPattern), 1365678427); } $routesWithHttpMethodConstraints[$uriPattern] = true; $route->setHttpMethods($routeConfiguration['httpMethods']); } else { if (isset($routesWithHttpMethodConstraints[$uriPattern]) && $routesWithHttpMethodConstraints[$uriPattern] === true) { throw new InvalidRouteSetupException(sprintf('There are multiple routes with the uriPattern "%s" and "httpMethods" option set. Please specify accepted HTTP methods for all of these, or adjust the uriPattern', $uriPattern), 1365678432); } $routesWithHttpMethodConstraints[$uriPattern] = false; } $this->routes[] = $route; } $this->routesCreated = true; }
/** * @test */ public function setNameCorrectlySetsRouteName() { $this->route->setName('SomeName'); $this->assertEquals('SomeName', $this->route->getName()); }
/** * Adds a route that can be used in the functional tests * * @param string $name Name of the route * @param string $uriPattern The uriPattern property of the route * @param array $defaults An array of defaults declarations * @param boolean $appendExceedingArguments If exceeding arguments may be appended * @param array $httpMethods An array of accepted http methods * @return Route * @api */ protected function registerRoute($name, $uriPattern, array $defaults, $appendExceedingArguments = false, array $httpMethods = null) { $route = new Route(); $route->setName($name); $route->setUriPattern($uriPattern); $route->setDefaults($defaults); $route->setAppendExceedingArguments($appendExceedingArguments); if ($httpMethods !== null) { $route->setHttpMethods($httpMethods); } $this->router->addRoute($route); return $route; }