Fixed tests

This commit is contained in:
William DURAND 2012-04-19 17:05:59 +02:00
parent c5891a59b9
commit 33ff68b2e0
3 changed files with 17 additions and 4 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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.',
),
),
);