analysisFromDockBlock($comment); $this->assertCount(3, $analysis); $this->assertInstanceOf(Info::class, $analysis[0]); $this->assertInstanceOf(Server::class, $analysis[1]); $this->assertInstanceOf(Server::class, $analysis[2]); $this->assertEquals('http://example.com', $analysis[1]->url); $this->assertEquals('First host', $analysis[1]->description); $this->assertEquals('http://example-second.com', $analysis[2]->url); $this->assertEquals('Second host', $analysis[2]->description); } /** * Test parse security scheme. */ public function testImplicitFlowAnnotation() { $comment = <<analysisFromDockBlock($comment); $this->assertCount(1, $analysis); /** @var \OpenApi\Annotations\SecurityScheme $security */ $security = $analysis[0]; $this->assertInstanceOf(SecurityScheme::class, $security); $this->assertCount(1, $security->flows); $this->assertEquals('implicit', $security->flows[0]->flow); $this->assertEquals('http://auth.test.com/token', $security->flows[0]->tokenUrl); $this->assertEquals('http://auth.test.com/refresh-token', $security->flows[0]->refreshUrl); } public function testMultipleAnnotations() { $comment = <<analysisFromDockBlock($comment); $this->assertCount(1, $analysis); /** @var \OpenApi\Annotations\SecurityScheme $security */ $security = $analysis[0]; $this->assertCount(2, $security->flows); $this->assertEquals('implicit', $security->flows[0]->flow); $this->assertEquals('http://auth.test.com/token', $security->flows[0]->tokenUrl); $this->assertEquals('http://auth.test.com/refresh-token', $security->flows[0]->refreshUrl); $this->assertEquals('client_credentials', $security->flows[1]->flow); $this->assertEquals('http://authClient.test.com', $security->flows[1]->authorizationUrl); $this->assertEquals('http://authClient.test.com/token', $security->flows[1]->tokenUrl); $this->assertEquals('http://authClient.test.com/refresh-token', $security->flows[1]->refreshUrl); } }