|
@@ 178-200 (lines=23) @@
|
| 175 |
|
$response = $defaultRouter($request, $response); |
| 176 |
|
} |
| 177 |
|
|
| 178 |
|
public function testMissingCompulsoryParameterWithHandler() |
| 179 |
|
{ |
| 180 |
|
$container = new Picotainer([ |
| 181 |
|
'controller' => function () { |
| 182 |
|
return new TestController2(); |
| 183 |
|
}, |
| 184 |
|
]); |
| 185 |
|
$parameterFetcherRegistry = ParameterFetcherRegistry::buildDefaultControllerRegistry(); |
| 186 |
|
$controllerAnalyzer = new ControllerAnalyzer($container, $parameterFetcherRegistry, new AnnotationReader()); |
| 187 |
|
$controllerRegistry = new ControllerRegistry($controllerAnalyzer, ['controller']); |
| 188 |
|
$defaultRouter = new SplashDefaultRouter($container, [ |
| 189 |
|
$controllerRegistry, |
| 190 |
|
], $parameterFetcherRegistry); |
| 191 |
|
|
| 192 |
|
$errorsController = HttpErrorsController::createDefault(); |
| 193 |
|
$defaultRouter->setHttp400Handler($errorsController); |
| 194 |
|
|
| 195 |
|
// We need an ID parameter |
| 196 |
|
$request = new ServerRequest([], [], '/foo/var/bar', 'GET'); |
| 197 |
|
$response = new HtmlResponse(''); |
| 198 |
|
$response = $defaultRouter($request, $response); |
| 199 |
|
$this->assertEquals(400, $response->getStatusCode()); |
| 200 |
|
} |
| 201 |
|
|
| 202 |
|
public function testExceptionWithHandler() |
| 203 |
|
{ |
|
@@ 202-224 (lines=23) @@
|
| 199 |
|
$this->assertEquals(400, $response->getStatusCode()); |
| 200 |
|
} |
| 201 |
|
|
| 202 |
|
public function testExceptionWithHandler() |
| 203 |
|
{ |
| 204 |
|
$container = new Picotainer([ |
| 205 |
|
'controller' => function () { |
| 206 |
|
return new TestController2(); |
| 207 |
|
}, |
| 208 |
|
]); |
| 209 |
|
$parameterFetcherRegistry = ParameterFetcherRegistry::buildDefaultControllerRegistry(); |
| 210 |
|
$controllerAnalyzer = new ControllerAnalyzer($container, $parameterFetcherRegistry, new AnnotationReader()); |
| 211 |
|
$controllerRegistry = new ControllerRegistry($controllerAnalyzer, ['controller']); |
| 212 |
|
$defaultRouter = new SplashDefaultRouter($container, [ |
| 213 |
|
$controllerRegistry, |
| 214 |
|
], $parameterFetcherRegistry); |
| 215 |
|
|
| 216 |
|
$errorsController = HttpErrorsController::createDefault(); |
| 217 |
|
$defaultRouter->setHttp500Handler($errorsController); |
| 218 |
|
|
| 219 |
|
// We need an ID parameter |
| 220 |
|
$request = new ServerRequest([], [], '/controller/triggerException', 'GET'); |
| 221 |
|
$response = new HtmlResponse(''); |
| 222 |
|
$response = $defaultRouter($request, $response); |
| 223 |
|
$this->assertEquals(500, $response->getStatusCode()); |
| 224 |
|
} |
| 225 |
|
|
| 226 |
|
public function testPurgeUrlCache() |
| 227 |
|
{ |