serverRequest($method, $url, $prefix); return (new Versions)->dispatch($req); } public function testFetchVersionList():void { $exp = new Response(['apiLevels' => ['v1-2']]); $this->assertMessage($exp, $this->req("GET", "/")); $this->assertMessage($exp, $this->req("GET", "/")); $this->assertMessage($exp, $this->req("GET", "/")); } public function testRespondToOptionsRequest():void { $exp = new EmptyResponse(204, ['Allow' => "HEAD,GET"]); $this->assertMessage($exp, $this->req("OPTIONS", "/")); } public function testUseIncorrectMethod():void { $exp = new EmptyResponse(405, ['Allow' => "HEAD,GET"]); $this->assertMessage($exp, $this->req("POST", "/")); } public function testUseIncorrectPath():void { $exp = new EmptyResponse(404); $this->assertMessage($exp, $this->req("GET", "/ook")); $this->assertMessage($exp, $this->req("OPTIONS", "/ook")); } }