From 1dc3380e8ea0239ad080f86fbda9ec6669088cdf Mon Sep 17 00:00:00 2001 From: Mario Franco Date: Fri, 3 May 2013 14:37:52 +0100 Subject: [PATCH] Refactor tests --- Tests/Extractor/ApiDocExtratorTest.php | 14 ++++++++++++++ Tests/Fixtures/Controller/TestController.php | 2 ++ Tests/Fixtures/app/config/routing.yml | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Tests/Extractor/ApiDocExtratorTest.php b/Tests/Extractor/ApiDocExtratorTest.php index e90bc95..68e8f70 100644 --- a/Tests/Extractor/ApiDocExtratorTest.php +++ b/Tests/Extractor/ApiDocExtratorTest.php @@ -153,6 +153,20 @@ class ApiDocExtractorTest extends WebTestCase "This method is useful to test if the getDocComment works.", $annotation->getDescription() ); + + $data = $annotation->toArray(); + $this->assertEquals( + 4, + count($data['requirements']) + ); + $this->assertEquals( + 'The param type', + $data['requirements']['paramType']['description'] + ); + $this->assertEquals( + 'The param id', + $data['requirements']['param']['description'] + ); } public function testGetWithAuthentication() diff --git a/Tests/Fixtures/Controller/TestController.php b/Tests/Fixtures/Controller/TestController.php index 53d57fb..79c67cb 100644 --- a/Tests/Fixtures/Controller/TestController.php +++ b/Tests/Fixtures/Controller/TestController.php @@ -73,6 +73,8 @@ class TestController * * @param int $id A nice comment * @param int $page + * @param int $paramType The param type + * @param int $param The param id */ public function myCommentedAction() { diff --git a/Tests/Fixtures/app/config/routing.yml b/Tests/Fixtures/app/config/routing.yml index 4dd5ea9..3467e05 100644 --- a/Tests/Fixtures/app/config/routing.yml +++ b/Tests/Fixtures/app/config/routing.yml @@ -20,7 +20,7 @@ test_route_4: defaults: { _controller: NelmioApiDocTestBundle:Test:any, _format: json } test_route_5: - pattern: /my-commented/{id}/{page} + pattern: /my-commented/{id}/{page}/{paramType}/{param} defaults: { _controller: NelmioApiDocTestBundle:Test:myCommented } test_route_6: