mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
added tests for headers support
This commit is contained in:
parent
d5c1c57cc9
commit
5123b49bf7
@ -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(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user