getMetadataFromDocBlock(new DocBlock($methodDocblock), new DocBlock($classDocblock)); $this->assertArrayNotHasKey('authenticated', $results); $this->assertNull($results['subgroup']); $this->assertSame('Endpoint title.', $results['title']); $this->assertSame("Endpoint description.\nMultiline.", $results['description']); } /** @test */ public function can_fetch_metadata_from_method_and_class() { $strategy = new GetFromDocBlocks(new DocumentationConfig([])); $methodDocblock = <<getMetadataFromDocBlock(new DocBlock($methodDocblock), new DocBlock($classDocblock)); $this->assertArrayNotHasKey('authenticated', $results); $this->assertNull($results['subgroup']); $this->assertSame('Group A', $results['groupName']); $this->assertSame('Group description.', $results['groupDescription']); $this->assertSame('Endpoint title.', $results['title']); $this->assertSame("Endpoint description.\nMultiline.", $results['description']); $methodDocblock = <<getMetadataFromDocBlock(new DocBlock($methodDocblock), new DocBlock($classDocblock)); $this->assertTrue($results['authenticated']); $this->assertSame(null, $results['groupName']); $this->assertSame('Scheiße', $results['subgroup']); $this->assertSame('Heilige Scheiße', $results['subgroupDescription']); $this->assertSame('', $results['groupDescription']); $this->assertSame('Endpoint title.', $results['title']); $this->assertSame("", $results['description']); } /** @test */ public function can_override_group_name_group_description_and_auth_status_from_method() { $strategy = new GetFromDocBlocks(new DocumentationConfig([])); $methodDocblock = <<getMetadataFromDocBlock(new DocBlock($methodDocblock), new DocBlock($classDocblock)); $this->assertTrue($results['authenticated']); $this->assertSame('Group from method', $results['groupName']); $this->assertSame("", $results['groupDescription']); $this->assertSame("This is the endpoint description.", $results['description']); $this->assertSame("Endpoint title.", $results['title']); } }