Merge pull request #191 from iambrosi/patch-1

Added check for deprecated setting
This commit is contained in:
William Durand 2013-05-10 01:30:50 -07:00
commit 3e8b896d00
5 changed files with 24 additions and 42 deletions

View File

@ -20,7 +20,7 @@ class MarkdownFormatter extends AbstractFormatter
{ {
$markdown = sprintf("### `%s` %s ###\n", $data['method'], $data['uri']); $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 .= "### This method is deprecated ###";
$markdown .= "\n\n"; $markdown .= "\n\n";
} }

View File

@ -15,7 +15,7 @@ use Nelmio\ApiDocBundle\Tests\WebTestCase;
class ApiDocExtractorTest extends WebTestCase class ApiDocExtractorTest extends WebTestCase
{ {
const ROUTES_QUANTITY = 18; const ROUTES_QUANTITY = 19;
public function testAll() public function testAll()
{ {

View File

@ -111,3 +111,9 @@ test_route_16:
defaults: { _controller: NelmioApiDocTestBundle:Test:zActionWithQueryParamNoDefault } defaults: { _controller: NelmioApiDocTestBundle:Test:zActionWithQueryParamNoDefault }
requirements: requirements:
_method: GET _method: GET
test_route_17:
pattern: /z-action-with-deprecated-indicator
defaults: { _controller: NelmioApiDocTestBundle:Test:deprecated }
requirements:
_method: GET

View File

@ -29,8 +29,6 @@ class MarkdownFormatterTest extends WebTestCase
## /tests ## ## /tests ##
### `GET` /tests.{_format} ### ### `GET` /tests.{_format} ###
### This method is deprecated ###
_index action_ _index action_
@ -52,8 +50,6 @@ b:
### `GET` /tests.{_format} ### ### `GET` /tests.{_format} ###
### This method is deprecated ###
_index action_ _index action_
@ -75,8 +71,6 @@ b:
### `POST` /tests.{_format} ### ### `POST` /tests.{_format} ###
### This method is deprecated ###
_create test_ _create test_
@ -105,8 +99,6 @@ test_type[c]:
### `POST` /tests.{_format} ### ### `POST` /tests.{_format} ###
### This method is deprecated ###
_create test_ _create test_
@ -137,8 +129,6 @@ test_type[c]:
## /tests2 ## ## /tests2 ##
### `POST` /tests2.{_format} ### ### `POST` /tests2.{_format} ###
### This method is deprecated ###
_post test 2_ _post test 2_
@ -149,8 +139,6 @@ _post test 2_
### `POST` /another-post ### ### `POST` /another-post ###
### This method is deprecated ###
_create another test_ _create another test_
@ -164,15 +152,11 @@ dependency_type[a]:
### `ANY` /any ### ### `ANY` /any ###
### This method is deprecated ###
_Action without HTTP verb_ _Action without HTTP verb_
### `ANY` /any/{foo} ### ### `ANY` /any/{foo} ###
### This method is deprecated ###
_Action without HTTP verb_ _Action without HTTP verb_
@ -183,14 +167,10 @@ _Action without HTTP verb_
### `ANY` /authenticated ### ### `ANY` /authenticated ###
### This method is deprecated ###
### `POST` /jms-input-test ### ### `POST` /jms-input-test ###
### This method is deprecated ###
_Testing JMS_ _Testing JMS_
@ -271,8 +251,6 @@ nested_array[]:
### `GET` /jms-return-test ### ### `GET` /jms-return-test ###
### This method is deprecated ###
_Testing return_ _Testing return_
@ -285,8 +263,6 @@ dependency_type[a]:
### `ANY` /my-commented/{id}/{page}/{paramType}/{param} ### ### `ANY` /my-commented/{id}/{page}/{paramType}/{param} ###
### This method is deprecated ###
_This method is useful to test if the getDocComment works._ _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 ### ### `ANY` /secure-route ###
### This method is deprecated ###
#### Requirements #### #### Requirements ####
@ -322,8 +296,6 @@ _This method is useful to test if the getDocComment works._
### `ANY` /yet-another/{id} ### ### `ANY` /yet-another/{id} ###
### This method is deprecated ###
#### Requirements #### #### Requirements ####
@ -333,11 +305,15 @@ _This method is useful to test if the getDocComment works._
- Requirement: \\d+ - Requirement: \\d+
### `GET` /z-action-with-query-param ### ### `GET` /z-action-with-deprecated-indicator ###
### This method is deprecated ### ### This method is deprecated ###
### `GET` /z-action-with-query-param ###
#### Filters #### #### Filters ####
page: page:
@ -348,8 +324,6 @@ page:
### `GET` /z-action-with-query-param-no-default ### ### `GET` /z-action-with-query-param-no-default ###
### This method is deprecated ###
#### Filters #### #### Filters ####
@ -361,8 +335,6 @@ page:
### `GET` /z-action-with-query-param-strict ### ### `GET` /z-action-with-query-param-strict ###
### This method is deprecated ###
#### Requirements #### #### Requirements ####
@ -374,8 +346,6 @@ page:
### `POST` /z-action-with-request-param ### ### `POST` /z-action-with-request-param ###
### This method is deprecated ###
#### Parameters #### #### Parameters ####
@ -400,8 +370,6 @@ MARKDOWN;
$expected = <<<MARKDOWN $expected = <<<MARKDOWN
### `GET` /tests.{_format} ### ### `GET` /tests.{_format} ###
### This method is deprecated ###
_index action_ _index action_

View File

@ -472,6 +472,14 @@ And, it supports multilines until the first \'@\' char.',
'deprecated' => false, 'deprecated' => false,
), ),
9 => 9 =>
array(
'method' => 'GET',
'uri' => '/z-action-with-deprecated-indicator',
'https' => false,
'authentication' => false,
'deprecated' => true,
),
10 =>
array( array(
'method' => 'GET', 'method' => 'GET',
'uri' => '/z-action-with-query-param', 'uri' => '/z-action-with-query-param',
@ -488,7 +496,7 @@ And, it supports multilines until the first \'@\' char.',
'authentication' => false, 'authentication' => false,
'deprecated' => false, 'deprecated' => false,
), ),
10 => 11 =>
array( array(
'method' => 'GET', 'method' => 'GET',
'uri' => '/z-action-with-query-param-no-default', 'uri' => '/z-action-with-query-param-no-default',
@ -504,7 +512,7 @@ And, it supports multilines until the first \'@\' char.',
'authentication' => false, 'authentication' => false,
'deprecated' => false, 'deprecated' => false,
), ),
11 => 12 =>
array( array(
'method' => 'GET', 'method' => 'GET',
'uri' => '/z-action-with-query-param-strict', 'uri' => '/z-action-with-query-param-strict',
@ -521,7 +529,7 @@ And, it supports multilines until the first \'@\' char.',
'authentication' => false, 'authentication' => false,
'deprecated' => false, 'deprecated' => false,
), ),
12 => 13 =>
array( array(
'method' => 'POST', 'method' => 'POST',
'uri' => '/z-action-with-request-param', 'uri' => '/z-action-with-request-param',