@@ 135-154 (lines=20) @@ | ||
132 | $response = $defaultRouter($request, $response); |
|
133 | } |
|
134 | ||
135 | public function testMissingCompulsoryParameter() |
|
136 | { |
|
137 | $container = new Picotainer([ |
|
138 | 'controller' => function () { |
|
139 | return new TestController2(); |
|
140 | }, |
|
141 | ]); |
|
142 | $parameterFetcherRegistry = ParameterFetcherRegistry::buildDefaultControllerRegistry(); |
|
143 | $controllerAnalyzer = new ControllerAnalyzer($container, $parameterFetcherRegistry, new AnnotationReader()); |
|
144 | $controllerRegistry = new ControllerRegistry($controllerAnalyzer, ['controller']); |
|
145 | $defaultRouter = new SplashDefaultRouter($container, [ |
|
146 | $controllerRegistry, |
|
147 | ], $parameterFetcherRegistry); |
|
148 | ||
149 | // We need an ID parameter |
|
150 | $request = new ServerRequest([], [], '/foo/var/bar', 'GET'); |
|
151 | $response = new HtmlResponse(''); |
|
152 | $this->expectException(SplashMissingParameterException::class); |
|
153 | $response = $defaultRouter($request, $response); |
|
154 | } |
|
155 | ||
156 | public function testMissingCompulsoryParameterWithHandler() |
|
157 | { |
|
@@ 215-233 (lines=19) @@ | ||
212 | $defaultRouter->purgeUrlsCache(); |
|
213 | } |
|
214 | ||
215 | public function testFilters() |
|
216 | { |
|
217 | $container = new Picotainer([ |
|
218 | 'controller' => function () { |
|
219 | return new TestFilteredController(); |
|
220 | }, |
|
221 | ]); |
|
222 | $parameterFetcherRegistry = ParameterFetcherRegistry::buildDefaultControllerRegistry(); |
|
223 | $controllerAnalyzer = new ControllerAnalyzer($container, $parameterFetcherRegistry, new AnnotationReader()); |
|
224 | $controllerRegistry = new ControllerRegistry($controllerAnalyzer, ['controller']); |
|
225 | $defaultRouter = new SplashDefaultRouter($container, [ |
|
226 | $controllerRegistry, |
|
227 | ], $parameterFetcherRegistry); |
|
228 | ||
229 | $request = new ServerRequest([], [], '/foo', 'GET'); |
|
230 | $response = new HtmlResponse(''); |
|
231 | $response = $defaultRouter($request, $response); |
|
232 | $this->assertEquals('42bar', (string) $response->getBody()); |
|
233 | } |
|
234 | ||
235 | public function testExpirationTag() |
|
236 | { |