setAppendExceedingArguments() public method

If set to FALSE, the route won't resolve if there are route values left after iterating through all Route Part handlers and removing the matching default values.
public setAppendExceedingArguments ( boolean $appendExceedingArguments ) : void
$appendExceedingArguments boolean TRUE: exceeding arguments will be appended to the resulting URI
return void
コード例 #1
0
 /**
  * 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);
 }
コード例 #2
0
 /**
  * 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);
 }
コード例 #3
0
 /**
  * @test
  */
 public function resolvesConvertsDomainObjectsToIdentityArrays()
 {
     $object1 = new \stdClass();
     $object2 = new \stdClass();
     $originalArray = ['foo' => 'bar', 'someObject' => $object1, 'baz' => ['someOtherObject' => $object2]];
     $convertedArray = ['foo' => 'bar', 'someObject' => ['__identity' => 'x'], 'baz' => ['someOtherObject' => ['__identity' => 'y']]];
     $mockPersistenceManager = $this->createMock(PersistenceManagerInterface::class);
     $mockPersistenceManager->expects($this->once())->method('convertObjectsToIdentityArrays')->with($originalArray)->will($this->returnValue($convertedArray));
     $this->inject($this->route, 'persistenceManager', $mockPersistenceManager);
     $this->route->setUriPattern('foo');
     $this->route->setAppendExceedingArguments(true);
     $this->route->_set('isParsed', true);
     $this->route->resolves($originalArray);
     $actualResult = $this->route->getResolvedUriPath();
     $expectedResult = '?foo=bar&someObject%5B__identity%5D=x&baz%5BsomeOtherObject%5D%5B__identity%5D=y';
     $this->assertEquals($expectedResult, $actualResult);
 }
コード例 #4
0
 /**
  * @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);
 }
コード例 #5
0
 /**
  * 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;
 }
コード例 #6
0
 /**
  * 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;
 }