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