Example #1
0
 public function testRunShouldSetAHttpError405ForRequestWithUnallowedMethod()
 {
     $app = new Application();
     $app->get('/test', function () {
     });
     $app->put('/test', function () {
     });
     $response = new ResponseMock();
     $app->run(Request::create(false, 'localhost', '/test', '', 'POST'), $response);
     $this->assertEquals('405 Method Not Allowed', $response->status());
     $this->assertContains('Allow: GET, PUT', $response->headers(), 'No header \'Allow: GET, PUT\' in ' . print_r($response->headers(), true));
 }