added tests for headers support

This commit is contained in:
miholeus 2016-05-19 18:20:41 +03:00
parent d5c1c57cc9
commit 5123b49bf7

View File

@ -34,6 +34,7 @@ class ApiDocTest extends TestCase
$this->assertFalse(isset($array['parameters'])); $this->assertFalse(isset($array['parameters']));
$this->assertNull($annot->getInput()); $this->assertNull($annot->getInput());
$this->assertFalse($array['authentication']); $this->assertFalse($array['authentication']);
$this->assertFalse(isset($array['headers']));
$this->assertTrue(is_array($array['authenticationRoles'])); $this->assertTrue(is_array($array['authenticationRoles']));
} }
@ -291,6 +292,28 @@ class ApiDocTest extends TestCase
$this->assertTrue(isset($array['parameters']['fooId']['dataType'])); $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() public function testConstructWithOneTag()
{ {
$data = array( $data = array(