buildGoodRequest(); $validator = (new ValidatorBuilder())->fromYamlFile($this->apiSpecFile)->getServerRequestValidator(); $validator->validate($request); $this->addToAssertionCount(1); } public function testResponseGreen() : void { $response = $this->buildGoodResponse(); $addr = new OperationAddress('/complete/{param1}/{param2}', 'post'); $validator = (new ValidatorBuilder())->fromYamlFile($this->apiSpecFile)->getResponseValidator(); $validator->validate($addr, $response); $this->addToAssertionCount(1); } protected function buildGoodRequest() : ServerRequestInterface { return (new ServerRequest('post', '/complete/good/2')) ->withQueryParams(['limit' => 10, 'filtering' => 'good']) ->withCookieParams(['session_id' => 100]) ->withHeader('X-RequestId', 'abcd') ->withHeader('Content-Type', 'application/json') ->withBody(stream_for(json_encode(['propB' => 'good value']))); } protected function buildGoodResponse() : ResponseInterface { return (new Response()) ->withHeader('Content-Type', 'application/json') ->withBody(stream_for(json_encode(['propA' => PHP_INT_MAX]))); } }