diff --git a/Formatter/MarkdownFormatter.php b/Formatter/MarkdownFormatter.php index e579d06..b4865ba 100644 --- a/Formatter/MarkdownFormatter.php +++ b/Formatter/MarkdownFormatter.php @@ -20,7 +20,7 @@ class MarkdownFormatter extends AbstractFormatter { $markdown = sprintf("### `%s` %s ###\n", $data['method'], $data['uri']); - if(isset($data['deprecated'])) { + if(isset($data['deprecated']) && false !== $data['deprecated']) { $markdown .= "### This method is deprecated ###"; $markdown .= "\n\n"; } diff --git a/Tests/Extractor/ApiDocExtractorTest.php b/Tests/Extractor/ApiDocExtractorTest.php index 057d1ac..8eba7ca 100644 --- a/Tests/Extractor/ApiDocExtractorTest.php +++ b/Tests/Extractor/ApiDocExtractorTest.php @@ -15,7 +15,7 @@ use Nelmio\ApiDocBundle\Tests\WebTestCase; class ApiDocExtractorTest extends WebTestCase { - const ROUTES_QUANTITY = 18; + const ROUTES_QUANTITY = 19; public function testAll() { diff --git a/Tests/Fixtures/app/config/routing.yml b/Tests/Fixtures/app/config/routing.yml index 0741d41..65cc687 100644 --- a/Tests/Fixtures/app/config/routing.yml +++ b/Tests/Fixtures/app/config/routing.yml @@ -111,3 +111,9 @@ test_route_16: defaults: { _controller: NelmioApiDocTestBundle:Test:zActionWithQueryParamNoDefault } requirements: _method: GET + +test_route_17: + pattern: /z-action-with-deprecated-indicator + defaults: { _controller: NelmioApiDocTestBundle:Test:deprecated } + requirements: + _method: GET diff --git a/Tests/Formatter/MarkdownFormatterTest.php b/Tests/Formatter/MarkdownFormatterTest.php index b9bde21..ff62f91 100644 --- a/Tests/Formatter/MarkdownFormatterTest.php +++ b/Tests/Formatter/MarkdownFormatterTest.php @@ -29,8 +29,6 @@ class MarkdownFormatterTest extends WebTestCase ## /tests ## ### `GET` /tests.{_format} ### -### This method is deprecated ### - _index action_ @@ -52,8 +50,6 @@ b: ### `GET` /tests.{_format} ### -### This method is deprecated ### - _index action_ @@ -75,8 +71,6 @@ b: ### `POST` /tests.{_format} ### -### This method is deprecated ### - _create test_ @@ -105,8 +99,6 @@ test_type[c]: ### `POST` /tests.{_format} ### -### This method is deprecated ### - _create test_ @@ -137,8 +129,6 @@ test_type[c]: ## /tests2 ## ### `POST` /tests2.{_format} ### -### This method is deprecated ### - _post test 2_ @@ -149,8 +139,6 @@ _post test 2_ ### `POST` /another-post ### -### This method is deprecated ### - _create another test_ @@ -164,15 +152,11 @@ dependency_type[a]: ### `ANY` /any ### -### This method is deprecated ### - _Action without HTTP verb_ ### `ANY` /any/{foo} ### -### This method is deprecated ### - _Action without HTTP verb_ @@ -183,14 +167,10 @@ _Action without HTTP verb_ ### `ANY` /authenticated ### -### This method is deprecated ### - ### `POST` /jms-input-test ### -### This method is deprecated ### - _Testing JMS_ @@ -271,8 +251,6 @@ nested_array[]: ### `GET` /jms-return-test ### -### This method is deprecated ### - _Testing return_ @@ -285,8 +263,6 @@ dependency_type[a]: ### `ANY` /my-commented/{id}/{page}/{paramType}/{param} ### -### This method is deprecated ### - _This method is useful to test if the getDocComment works._ @@ -310,8 +286,6 @@ _This method is useful to test if the getDocComment works._ ### `ANY` /secure-route ### -### This method is deprecated ### - #### Requirements #### @@ -322,8 +296,6 @@ _This method is useful to test if the getDocComment works._ ### `ANY` /yet-another/{id} ### -### This method is deprecated ### - #### Requirements #### @@ -333,11 +305,15 @@ _This method is useful to test if the getDocComment works._ - Requirement: \\d+ -### `GET` /z-action-with-query-param ### +### `GET` /z-action-with-deprecated-indicator ### ### This method is deprecated ### + +### `GET` /z-action-with-query-param ### + + #### Filters #### page: @@ -348,8 +324,6 @@ page: ### `GET` /z-action-with-query-param-no-default ### -### This method is deprecated ### - #### Filters #### @@ -361,8 +335,6 @@ page: ### `GET` /z-action-with-query-param-strict ### -### This method is deprecated ### - #### Requirements #### @@ -374,8 +346,6 @@ page: ### `POST` /z-action-with-request-param ### -### This method is deprecated ### - #### Parameters #### @@ -400,8 +370,6 @@ MARKDOWN; $expected = << false, ), 9 => + array( + 'method' => 'GET', + 'uri' => '/z-action-with-deprecated-indicator', + 'https' => false, + 'authentication' => false, + 'deprecated' => true, + ), + 10 => array( 'method' => 'GET', 'uri' => '/z-action-with-query-param', @@ -488,7 +496,7 @@ And, it supports multilines until the first \'@\' char.', 'authentication' => false, 'deprecated' => false, ), - 10 => + 11 => array( 'method' => 'GET', 'uri' => '/z-action-with-query-param-no-default', @@ -504,7 +512,7 @@ And, it supports multilines until the first \'@\' char.', 'authentication' => false, 'deprecated' => false, ), - 11 => + 12 => array( 'method' => 'GET', 'uri' => '/z-action-with-query-param-strict', @@ -521,7 +529,7 @@ And, it supports multilines until the first \'@\' char.', 'authentication' => false, 'deprecated' => false, ), - 12 => + 13 => array( 'method' => 'POST', 'uri' => '/z-action-with-request-param',