/** * X-HTTP-Method-Override is available. * * In HTTP header. * X-HTTP-Method-Override: PUT * In HTML form. * <input name="_method" value="PUT" type="hidden"/> */ public function testMethodOverride() { $r = new Router(); $r->patch('/override', function () { return new Response('PATCH'); }); $req = Request::create('/override', 'POST'); $res = $r->run($req); $this->assertEquals(404, $res->getStatusCode()); $req = Request::create('/override', 'POST', [], [], [], ['HTTP_X-HTTP-Method-Override' => 'PATCH']); $res = $r->run($req); $this->assertEquals(200, $res->getStatusCode()); $this->assertEquals('PATCH', $res->getContent()); $req = Request::create('/override', 'POST', ['_method' => 'PATCH']); $res = $r->run($req); $this->assertEquals(200, $res->getStatusCode()); $this->assertEquals('PATCH', $res->getContent()); }