/**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $route = new Route();
     $route->setName('Functional Test - Http::Client::InternalRequestEngine');
     $route->setUriPattern('test/security/restricted');
     $route->setDefaults(array('@package' => 'TYPO3.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(array('@package' => 'TYPO3.Flow', '@subpackage' => 'Tests\\Functional\\Session\\Fixtures', '@controller' => 'SessionTest', '@action' => 'sessionStart', '@format' => 'html'));
     $this->router->addRoute($route);
 }
 /**
  * @test
  */
 public function parseSetsDefaultValueOfRoutePartsRecursively()
 {
     $this->route->setUriPattern('{foo.bar}');
     $this->route->setRoutePartsConfiguration(array('foo.bar' => array('handler' => 'SomeRoutePartHandler')));
     $this->route->setDefaults(array('foo' => array('bar' => 'SomeDefaultValue')));
     $mockRoutePartHandler = $this->getMock(\TYPO3\Flow\Mvc\Routing\DynamicRoutePartInterface::class);
     $mockRoutePartHandler->expects($this->once())->method('setDefaultValue')->with('SomeDefaultValue');
     $this->mockObjectManager->expects($this->once())->method('get')->with('SomeRoutePartHandler')->will($this->returnValue($mockRoutePartHandler));
     $this->route->parse();
 }
 /**
  * Additional setup: Routes
  */
 public function setUp()
 {
     parent::setUp();
     $route = new Route();
     $route->setName('WidgetTest');
     $route->setUriPattern('test/widget/{@controller}(/{@action})');
     $route->setDefaults(array('@package' => 'TYPO3.Fluid', '@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(array('@package' => 'TYPO3.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(\TYPO3\Flow\Security\AccountRepository::class);
     $accountFactory = $this->objectManager->get(\TYPO3\Flow\Security\AccountFactory::class);
     $account = $accountFactory->createAccountWithPassword('functional_test_account', 'a_very_secure_long_password', array('TYPO3.Flow:Administrator'), 'TestingProvider');
     $accountRepository->add($account);
     $account2 = $accountFactory->createAccountWithPassword('functional_test_account', 'a_very_secure_long_password', array('TYPO3.Flow:Administrator'), 'HttpBasicTestingProvider');
     $accountRepository->add($account2);
     $account3 = $accountFactory->createAccountWithPassword('functional_test_account', 'a_very_secure_long_password', array('TYPO3.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(array('@package' => 'TYPO3.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(array('@package' => 'TYPO3.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(array('@package' => 'TYPO3.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(array('@package' => 'TYPO3.Flow', '@subpackage' => 'Tests\\Functional\\Security\\Fixtures', '@controller' => 'UsernamePasswordTest', '@action' => 'authenticate', '@format' => 'html'));
     $route4->setAppendExceedingArguments(true);
     $this->router->addRoute($route4);
 }
 /**
  * Creates \TYPO3\Flow\Mvc\Routing\Route objects from the injected routes
  * configuration.
  *
  * @return void
  * @throws InvalidRouteSetupException
  */
 protected function createRoutesFromConfiguration()
 {
     if ($this->routesCreated === FALSE) {
         $this->routes = array();
         $routesWithHttpMethodConstraints = array();
         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;
     }
 }
 /**
  * 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
  * @return void
  * @api
  */
 protected function registerRoute($name, $uriPattern, array $defaults, $appendExceedingArguments = FALSE)
 {
     $route = new Route();
     $route->setName($name);
     $route->setUriPattern($uriPattern);
     $route->setDefaults($defaults);
     $route->setAppendExceedingArguments($appendExceedingArguments);
     $this->router->addRoute($route);
 }
 /**
  * Calls the given action of the given controller
  *
  * @param string $controllerName The name of the controller to be called
  * @param string $controllerPackageKey The package key the controller resides in
  * @param string $controllerActionName The name of the action to be called, e.g. 'index'
  * @param array $arguments Optional arguments passed to controller
  * @param string $format The request format, defaults to 'html'
  * @return string The result of the controller action
  * @deprecated since 1.1
  */
 protected function sendWebRequest($controllerName, $controllerPackageKey, $controllerActionName, array $arguments = array(), $format = 'html')
 {
     $this->setupHttp();
     $route = new \TYPO3\Flow\Mvc\Routing\Route();
     $route->setName('sendWebRequest Route');
     $uriPattern = 'test/' . uniqid();
     $route->setUriPattern($uriPattern);
     $route->setDefaults(array('@package' => $controllerPackageKey, '@controller' => $controllerName, '@action' => $controllerActionName, '@format' => $format));
     $route->setAppendExceedingArguments(TRUE);
     $this->router->addRoute($route);
     $uri = new \TYPO3\Flow\Http\Uri('http://baseuri/' . $uriPattern);
     $response = $this->browser->request($uri, 'POST', $arguments);
     return $response->getContent();
 }
 /**
  * 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 void
  * @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);
 }