setRoutesConfiguration() public method

Sets the routes configuration.
public setRoutesConfiguration ( array $routesConfiguration = null ) : void
$routesConfiguration array The routes configuration or NULL if it should be fetched from configuration
return void
Exemplo n.º 1
0
 /**
  * Set the routes configuration for the Neos setup and configures the routing component
  * to skip initialisation, which would overwrite the specific settings again.
  *
  * @param ComponentContext $componentContext
  * @return void
  */
 public function handle(ComponentContext $componentContext)
 {
     $configurationSource = $this->objectManager->get(\Neos\Flow\Configuration\Source\YamlSource::class);
     $routesConfiguration = $configurationSource->load($this->packageManager->getPackage('Neos.Setup')->getConfigurationPath() . ConfigurationManager::CONFIGURATION_TYPE_ROUTES);
     $this->router->setRoutesConfiguration($routesConfiguration);
     $componentContext->setParameter(\Neos\Flow\Mvc\Routing\RoutingComponent::class, 'skipRouterInitialization', true);
 }
 /**
  * @test
  * @expectedException \Neos\Flow\Mvc\Exception\InvalidRouteSetupException
  */
 public function createRoutesFromConfigurationThrowsExceptionIfOnlySomeRoutesWithTheSameUriPatternHaveHttpMethodConstraints()
 {
     $routesConfiguration = [['uriPattern' => 'somePattern'], ['uriPattern' => 'somePattern', 'httpMethods' => ['POST', 'PUT']]];
     shuffle($routesConfiguration);
     $this->router->setRoutesConfiguration($routesConfiguration);
     $this->router->_call('createRoutesFromConfiguration');
 }
 /**
  * Sets up a virtual browser and web environment for seamless HTTP and MVC
  * related tests.
  *
  * @return void
  */
 protected function setupHttp()
 {
     $this->browser = new \Neos\Flow\Http\Client\Browser();
     $this->browser->setRequestEngine(new \Neos\Flow\Http\Client\InternalRequestEngine());
     $this->router = $this->browser->getRequestEngine()->getRouter();
     $this->router->setRoutesConfiguration(null);
     $requestHandler = self::$bootstrap->getActiveRequestHandler();
     $request = Request::create(new \Neos\Flow\Http\Uri('http://localhost/typo3/flow/test'));
     $componentContext = new ComponentContext($request, new \Neos\Flow\Http\Response());
     $requestHandler->setComponentContext($componentContext);
 }