mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Fixed tests
This commit is contained in:
parent
c5891a59b9
commit
33ff68b2e0
@ -180,7 +180,7 @@ class ApiDocExtractor
|
||||
protected function getData(ApiDoc $annotation, Route $route, \ReflectionMethod $method)
|
||||
{
|
||||
if (null === $annotation->getDescription()) {
|
||||
$comments = explode('\n', $this->getDocComment($method));
|
||||
$comments = explode("\n", $this->getDocComment($method));
|
||||
// just set the first line
|
||||
$annotation->setDescription($comments[0]);
|
||||
}
|
||||
@ -194,11 +194,10 @@ class ApiDocExtractor
|
||||
|
||||
// let's clean the doc block
|
||||
$comment = str_replace('/**', '', $comment);
|
||||
$comment = str_replace('*/', '', $comment);
|
||||
$comment = str_replace('*', '', $comment);
|
||||
$comment = str_replace('*/', '', $comment);
|
||||
$comment = str_replace("\r", '', trim($comment));
|
||||
$comment = preg_replace("#\n[ \t]+#i", "\n", trim($comment));
|
||||
$comment = str_replace("\n", "\\n", trim($comment));
|
||||
$comment = preg_replace("#^\n[ \t]+[*]?#i", "\n", trim($comment));
|
||||
$comment = preg_replace("#[\t ]+#i", ' ', trim($comment));
|
||||
$comment = str_replace("\"", "\\\"", $comment);
|
||||
|
||||
|
@ -105,6 +105,11 @@ _Action without HTTP verb_
|
||||
### `ANY` /any ###
|
||||
|
||||
_Action without HTTP verb_
|
||||
|
||||
|
||||
### `ANY` /my-commented ###
|
||||
|
||||
_This method is useful to test if the getDocComment works._
|
||||
MARKDOWN;
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
|
@ -145,6 +145,15 @@ class SimpleFormatterTest extends WebTestCase
|
||||
),
|
||||
'description' => 'Action without HTTP verb',
|
||||
),
|
||||
2 =>
|
||||
array(
|
||||
'method' => 'ANY',
|
||||
'uri' => '/my-commented',
|
||||
'requirements' =>
|
||||
array(
|
||||
),
|
||||
'description' => 'This method is useful to test if the getDocComment works.',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user