|
16 | 16 | use Symfony\Bundle\FrameworkBundle\Routing\Router;
|
17 | 17 | use Symfony\Component\Config\Loader\LoaderInterface;
|
18 | 18 | use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
|
| 19 | +use Symfony\Component\DependencyInjection\Exception\RuntimeException; |
19 | 20 | use Symfony\Component\Routing\Route;
|
20 | 21 | use Symfony\Component\Routing\RouteCollection;
|
21 | 22 |
|
@@ -278,13 +279,13 @@ public function testPatternPlaceholdersWithSfContainer()
|
278 | 279 | $routes->add('foo', new Route('/before/%parameter.foo%/after/%%escaped%%'));
|
279 | 280 |
|
280 | 281 | $sc = $this->getServiceContainer($routes);
|
281 |
| - $sc->setParameter('parameter.foo', 'foo'); |
| 282 | + $sc->setParameter('parameter.foo', 'foo-%%escaped%%'); |
282 | 283 |
|
283 | 284 | $router = new Router($sc, 'foo');
|
284 | 285 | $route = $router->getRouteCollection()->get('foo');
|
285 | 286 |
|
286 | 287 | $this->assertEquals(
|
287 |
| - '/before/foo/after/%escaped%', |
| 288 | + '/before/foo-%escaped%/after/%escaped%', |
288 | 289 | $route->getPath()
|
289 | 290 | );
|
290 | 291 | }
|
@@ -313,6 +314,22 @@ public function testEnvPlaceholdersWithSfContainer()
|
313 | 314 | $router->getRouteCollection();
|
314 | 315 | }
|
315 | 316 |
|
| 317 | + public function testIndirectEnvPlaceholders() |
| 318 | + { |
| 319 | + $routes = new RouteCollection(); |
| 320 | + |
| 321 | + $routes->add('foo', new Route('/%foo%')); |
| 322 | + |
| 323 | + $router = new Router($container = $this->getServiceContainer($routes), 'foo'); |
| 324 | + $container->setParameter('foo', 'foo-%bar%'); |
| 325 | + $container->setParameter('bar', '%env(string:FOO)%'); |
| 326 | + |
| 327 | + $this->expectException(RuntimeException::class); |
| 328 | + $this->expectExceptionMessage('Using "%env(string:FOO)%" is not allowed in routing configuration.'); |
| 329 | + |
| 330 | + $router->getRouteCollection(); |
| 331 | + } |
| 332 | + |
316 | 333 | public function testHostPlaceholders()
|
317 | 334 | {
|
318 | 335 | $routes = new RouteCollection();
|
|
0 commit comments