|
@@ 156-178 (lines=23) @@
|
| 153 |
|
$response = $defaultRouter($request, $response); |
| 154 |
|
} |
| 155 |
|
|
| 156 |
|
public function testMissingCompulsoryParameterWithHandler() |
| 157 |
|
{ |
| 158 |
|
$container = new Picotainer([ |
| 159 |
|
'controller' => function () { |
| 160 |
|
return new TestController2(); |
| 161 |
|
}, |
| 162 |
|
]); |
| 163 |
|
$parameterFetcherRegistry = ParameterFetcherRegistry::buildDefaultControllerRegistry(); |
| 164 |
|
$controllerAnalyzer = new ControllerAnalyzer($container, $parameterFetcherRegistry, new AnnotationReader()); |
| 165 |
|
$controllerRegistry = new ControllerRegistry($controllerAnalyzer, ['controller']); |
| 166 |
|
$defaultRouter = new SplashDefaultRouter($container, [ |
| 167 |
|
$controllerRegistry, |
| 168 |
|
], $parameterFetcherRegistry); |
| 169 |
|
|
| 170 |
|
$errorsController = HttpErrorsController::createDefault(); |
| 171 |
|
$defaultRouter->setHttp400Handler($errorsController); |
| 172 |
|
|
| 173 |
|
// We need an ID parameter |
| 174 |
|
$request = new ServerRequest([], [], '/foo/var/bar', 'GET'); |
| 175 |
|
$response = new HtmlResponse(''); |
| 176 |
|
$response = $defaultRouter($request, $response); |
| 177 |
|
$this->assertEquals(400, $response->getStatusCode()); |
| 178 |
|
} |
| 179 |
|
|
| 180 |
|
public function testExceptionWithHandler() |
| 181 |
|
{ |
|
@@ 180-202 (lines=23) @@
|
| 177 |
|
$this->assertEquals(400, $response->getStatusCode()); |
| 178 |
|
} |
| 179 |
|
|
| 180 |
|
public function testExceptionWithHandler() |
| 181 |
|
{ |
| 182 |
|
$container = new Picotainer([ |
| 183 |
|
'controller' => function () { |
| 184 |
|
return new TestController2(); |
| 185 |
|
}, |
| 186 |
|
]); |
| 187 |
|
$parameterFetcherRegistry = ParameterFetcherRegistry::buildDefaultControllerRegistry(); |
| 188 |
|
$controllerAnalyzer = new ControllerAnalyzer($container, $parameterFetcherRegistry, new AnnotationReader()); |
| 189 |
|
$controllerRegistry = new ControllerRegistry($controllerAnalyzer, ['controller']); |
| 190 |
|
$defaultRouter = new SplashDefaultRouter($container, [ |
| 191 |
|
$controllerRegistry, |
| 192 |
|
], $parameterFetcherRegistry); |
| 193 |
|
|
| 194 |
|
$errorsController = HttpErrorsController::createDefault(); |
| 195 |
|
$defaultRouter->setHttp500Handler($errorsController); |
| 196 |
|
|
| 197 |
|
// We need an ID parameter |
| 198 |
|
$request = new ServerRequest([], [], '/controller/triggerException', 'GET'); |
| 199 |
|
$response = new HtmlResponse(''); |
| 200 |
|
$response = $defaultRouter($request, $response); |
| 201 |
|
$this->assertEquals(500, $response->getStatusCode()); |
| 202 |
|
} |
| 203 |
|
|
| 204 |
|
public function testPurgeUrlCache() |
| 205 |
|
{ |