public function testGenerateForRouteWithInvalidParameter() { $this->
expectException(InvalidParameterException::
class);
$routes =
$this->
getRoutes('test',
new Route('/testing/{foo}',
[],
['foo' => '1|2'
]));
$this->
getGenerator($routes)->
generate('test',
['foo' => '0'
], UrlGeneratorInterface::ABSOLUTE_URL
);
} public function testGenerateForRouteWithInvalidOptionalParameterNonStrict() { $routes =
$this->
getRoutes('test',
new Route('/testing/{foo}',
['foo' => '1'
],
['foo' => 'd+'
]));
$generator =
$this->
getGenerator($routes);
$generator->
setStrictRequirements(false
);
$this->
assertSame('',
$generator->
generate('test',
['foo' => 'bar'
], UrlGeneratorInterface::ABSOLUTE_URL
));
} public function testGenerateForRouteWithInvalidOptionalParameterNonStrictWithLogger() { $routes =
$this->
getRoutes('test',
new Route('/testing/{foo}',
['foo' => '1'
],
['foo' => 'd+'
]));
$logger =
$this->
createMock(LoggerInterface::
class);
$logger->
expects($this->
once()) ->
method('error'
);
$generator =
$this->
getGenerator($routes,
[],
$logger);
$generator->
setStrictRequirements(false
);