|
14 | 14 | use PHPUnit\Framework\TestCase;
|
15 | 15 | use Symfony\Component\Config\Loader\LoaderInterface;
|
16 | 16 | use Symfony\Component\HttpFoundation\Request;
|
| 17 | +use Symfony\Component\Routing\Generator\CompiledUrlGenerator; |
17 | 18 | use Symfony\Component\Routing\Generator\UrlGenerator;
|
18 | 19 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
19 | 20 | use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
|
@@ -124,11 +125,24 @@ public function testGeneratorIsCreatedIfCacheIsNotConfigured()
|
124 | 125 | {
|
125 | 126 | $this->router->setOption('cache_dir', null);
|
126 | 127 |
|
| 128 | + $this->loader->expects($this->once()) |
| 129 | + ->method('load')->with('routing.yml', null) |
| 130 | + ->willReturn(new RouteCollection()); |
| 131 | + |
| 132 | + $this->assertInstanceOf(CompiledUrlGenerator::class, $this->router->getGenerator()); |
| 133 | + } |
| 134 | + |
| 135 | + public function testGeneratorIsCreatedIfCacheIsNotConfiguredNotCompiled() |
| 136 | + { |
| 137 | + $this->router->setOption('cache_dir', null); |
| 138 | + $this->router->setOption('generator_class', UrlGenerator::class); |
| 139 | + |
127 | 140 | $this->loader->expects($this->once())
|
128 | 141 | ->method('load')->with('routing.yml', null)
|
129 | 142 | ->willReturn(new RouteCollection());
|
130 | 143 |
|
131 | 144 | $this->assertInstanceOf(UrlGenerator::class, $this->router->getGenerator());
|
| 145 | + $this->assertNotInstanceOf(CompiledUrlGenerator::class, $this->router->getGenerator()); |
132 | 146 | }
|
133 | 147 |
|
134 | 148 | public function testMatchRequestWithUrlMatcherInterface()
|
|
0 commit comments