| @@ 1233-1249 (lines=17) @@ | ||
| 1230 | } |
|
| 1231 | } |
|
| 1232 | ||
| 1233 | public function test405DefaultRequest() |
|
| 1234 | { |
|
| 1235 | $this->klein_app->respond( |
|
| 1236 | array('GET', 'POST'), |
|
| 1237 | '/', |
|
| 1238 | function () { |
|
| 1239 | echo 'fail'; |
|
| 1240 | } |
|
| 1241 | ); |
|
| 1242 | ||
| 1243 | $this->klein_app->dispatch( |
|
| 1244 | MockRequestFactory::create('/', 'DELETE') |
|
| 1245 | ); |
|
| 1246 | ||
| 1247 | $this->assertEquals('405 Method Not Allowed', $this->klein_app->response()->status()->getFormattedString()); |
|
| 1248 | $this->assertEquals('GET, POST', $this->klein_app->response()->headers()->get('Allow')); |
|
| 1249 | } |
|
| 1250 | ||
| 1251 | public function testNo405OnNonMatchRoutes() |
|
| 1252 | { |
|
| @@ 1357-1378 (lines=22) @@ | ||
| 1354 | $this->assertSame(405, $this->klein_app->response()->code()); |
|
| 1355 | } |
|
| 1356 | ||
| 1357 | public function testOptionsDefaultRequest() |
|
| 1358 | { |
|
| 1359 | $this->klein_app->respond( |
|
| 1360 | function ($request, $response) { |
|
| 1361 | $response->code(200); |
|
| 1362 | } |
|
| 1363 | ); |
|
| 1364 | $this->klein_app->respond( |
|
| 1365 | array('GET', 'POST'), |
|
| 1366 | '/', |
|
| 1367 | function () { |
|
| 1368 | echo 'fail'; |
|
| 1369 | } |
|
| 1370 | ); |
|
| 1371 | ||
| 1372 | $this->klein_app->dispatch( |
|
| 1373 | MockRequestFactory::create('/', 'OPTIONS') |
|
| 1374 | ); |
|
| 1375 | ||
| 1376 | $this->assertEquals('200 OK', $this->klein_app->response()->status()->getFormattedString()); |
|
| 1377 | $this->assertEquals('GET, POST', $this->klein_app->response()->headers()->get('Allow')); |
|
| 1378 | } |
|
| 1379 | ||
| 1380 | public function testOptionsRoutes() |
|
| 1381 | { |
|