parseComment($comment), new Context()); $this->assertCount(3, $analysis->annotations); $response = $analysis->getAnnotationsOfType(Response::class)[0]; $this->assertSame(Generator::UNDEFINED, $response->content); $this->assertCount(1, $response->_unmerged); $analysis->process(new MergeXmlContent()); $this->assertCount(1, $response->content); $this->assertCount(0, $response->_unmerged); $json = json_decode(json_encode($response), true); $this->assertSame('#/components/schemas/repository', $json['content']['application/xml']['schema']['items']['$ref']); } public function testMultipleMediaTypes() { $comment = <<parseComment($comment), new Context()); $response = $analysis->getAnnotationsOfType(Response::class)[0]; $this->assertCount(1, $response->content); $analysis->process(new MergeXmlContent()); $this->assertCount(2, $response->content); } public function testParameter() { $comment = <<parseComment($comment), new Context()); $this->assertCount(4, $analysis->annotations); $parameter = $analysis->getAnnotationsOfType(Parameter::class)[0]; $this->assertSame(Generator::UNDEFINED, $parameter->content); $this->assertCount(1, $parameter->_unmerged); $analysis->process(new MergeXmlContent()); $this->assertCount(1, $parameter->content); $this->assertCount(0, $parameter->_unmerged); $json = json_decode(json_encode($parameter), true); $this->assertSame('query', $json['in']); $this->assertSame('application/xml', array_keys($json['content'])[0]); $this->assertArrayNotHasKey('mediaType', $json['content']['application/xml']); } public function testNoParent() { $this->assertOpenApiLogEntryContains('Unexpected @OA\XmlContent() must be nested'); $comment = <<parseComment($comment), new Context()); $analysis->process(new MergeXmlContent()); } public function testInvalidParent() { $this->assertOpenApiLogEntryContains('Unexpected @OA\XmlContent() in @OA\Property() in'); $comment = <<parseComment($comment), new Context()); $analysis->process(new MergeXmlContent()); } }