mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Adding test for named resource
This commit is contained in:
parent
56fdd4e64c
commit
8f6ac59c97
@ -15,7 +15,7 @@ use Nelmio\ApiDocBundle\Tests\WebTestCase;
|
||||
|
||||
class ApiDocExtractorTest extends WebTestCase
|
||||
{
|
||||
const ROUTES_QUANTITY = 20;
|
||||
const ROUTES_QUANTITY = 21;
|
||||
|
||||
public function testAll()
|
||||
{
|
||||
@ -66,8 +66,13 @@ class ApiDocExtractorTest extends WebTestCase
|
||||
$this->assertFalse(isset($array2['filters']));
|
||||
$this->assertEquals('Nelmio\ApiDocBundle\Tests\Fixtures\Form\TestType', $a2->getInput());
|
||||
|
||||
$a3 = $data['13']['annotation'];
|
||||
$a4 = $data[5]['annotation'];
|
||||
$this->assertTrue($a4->isResource());
|
||||
$this->assertEquals('TestResource', $a4->getResource());
|
||||
|
||||
$a3 = $data['14']['annotation'];
|
||||
$this->assertTrue($a3->getHttps());
|
||||
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
|
@ -19,6 +19,15 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
|
||||
|
||||
class TestController
|
||||
{
|
||||
/**
|
||||
* @ApiDoc(
|
||||
* resource="TestResource"
|
||||
* )
|
||||
*/
|
||||
public function namedResourceAction()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiDoc(
|
||||
* resource=true,
|
||||
|
@ -121,3 +121,7 @@ test_route_17:
|
||||
test_return_nested_output:
|
||||
pattern: /return-nested-output
|
||||
defaults: { _controller: NelmioApiDocTestBundle:Test:jmsReturnNestedOutput, _format: json }
|
||||
|
||||
test_route_named_resource:
|
||||
pattern: /named-resource
|
||||
defaults: { _controller: NelmioApiDocTestBundle:Test:namedResource }
|
||||
|
@ -138,6 +138,12 @@ _post test 2_
|
||||
|
||||
|
||||
|
||||
## TestResource ##
|
||||
|
||||
### `ANY` /named-resource ###
|
||||
|
||||
|
||||
|
||||
### `POST` /another-post ###
|
||||
|
||||
_create another test_
|
||||
|
@ -844,6 +844,17 @@ With multiple lines.',
|
||||
'deprecated' => false,
|
||||
),
|
||||
),
|
||||
'TestResource' =>
|
||||
array(
|
||||
0 =>
|
||||
array(
|
||||
'method' => 'ANY',
|
||||
'uri' => '/named-resource',
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'deprecated' => false,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
|
Loading…
x
Reference in New Issue
Block a user