diff --git a/Formatter/MarkdownFormatter.php b/Formatter/MarkdownFormatter.php index 74ae888..15c50a5 100644 --- a/Formatter/MarkdownFormatter.php +++ b/Formatter/MarkdownFormatter.php @@ -80,7 +80,7 @@ class MarkdownFormatter extends AbstractFormatter $markdown .= "\n"; } - return $markdown; + return trim($markdown); } private function renderResourceSection($resource, array $arrayOfData) diff --git a/Tests/Formatter/MarkdownFormatterTest.php b/Tests/Formatter/MarkdownFormatterTest.php new file mode 100644 index 0000000..5eb2418 --- /dev/null +++ b/Tests/Formatter/MarkdownFormatterTest.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Nelmio\ApiDocBundle\Tests\Formatter; + +use Nelmio\ApiDocBundle\Tests\WebTestCase; + +class MarkdownFormatterTest extends WebTestCase +{ + public function testFormat() + { + $container = $this->getContainer(); + + $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); + $data = $extractor->all(); + $result = $container->get('nelmio_api_doc.formatter.markdown_formatter')->format($data); + + $expected = <<assertEquals($expected, $result); + } +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 8d27747..930c1c4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,4 @@ - - + bootstrap = "Tests/bootstrap.php"> - + Tests