From 5123b49bf7c53eca54358e1e18697c1b321b53f4 Mon Sep 17 00:00:00 2001 From: miholeus Date: Thu, 19 May 2016 18:20:41 +0300 Subject: [PATCH] added tests for headers support --- Tests/Annotation/ApiDocTest.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Tests/Annotation/ApiDocTest.php b/Tests/Annotation/ApiDocTest.php index e52246c..c58d2d4 100644 --- a/Tests/Annotation/ApiDocTest.php +++ b/Tests/Annotation/ApiDocTest.php @@ -34,6 +34,7 @@ class ApiDocTest extends TestCase $this->assertFalse(isset($array['parameters'])); $this->assertNull($annot->getInput()); $this->assertFalse($array['authentication']); + $this->assertFalse(isset($array['headers'])); $this->assertTrue(is_array($array['authenticationRoles'])); } @@ -291,6 +292,28 @@ class ApiDocTest extends TestCase $this->assertTrue(isset($array['parameters']['fooId']['dataType'])); } + public function testConstructWithHeaders() + { + $data = array( + 'headers' => array( + array( + 'name' => 'headerName', + 'description' => 'Some description' + ) + ) + ); + + $annot = new ApiDoc($data); + $array = $annot->toArray(); + + $this->assertArrayHasKey('headerName', $array['headers']); + $this->assertNotEmpty($array['headers']['headerName']); + + $keys = array_keys($array['headers']); + $this->assertEquals($data['headers'][0]['name'], $keys[0]); + $this->assertEquals($data['headers'][0]['description'], $array['headers']['headerName']['description']); + } + public function testConstructWithOneTag() { $data = array(