mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-09 02:59:27 +03:00
Added more tests
This commit is contained in:
parent
37bf987688
commit
af48be4fc4
@ -80,7 +80,7 @@ class MarkdownFormatter extends AbstractFormatter
|
|||||||
$markdown .= "\n";
|
$markdown .= "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $markdown;
|
return trim($markdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function renderResourceSection($resource, array $arrayOfData)
|
private function renderResourceSection($resource, array $arrayOfData)
|
||||||
|
65
Tests/Formatter/MarkdownFormatterTest.php
Normal file
65
Tests/Formatter/MarkdownFormatterTest.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the NelmioApiDocBundle.
|
||||||
|
*
|
||||||
|
* (c) Nelmio <hello@nelm.io>
|
||||||
|
*
|
||||||
|
* 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 = <<<MARKDOWN
|
||||||
|
# /tests #
|
||||||
|
|
||||||
|
### `GET` /tests ###
|
||||||
|
|
||||||
|
_index action_
|
||||||
|
|
||||||
|
#### Filters ####
|
||||||
|
|
||||||
|
a:
|
||||||
|
|
||||||
|
* dataType: integer
|
||||||
|
|
||||||
|
b:
|
||||||
|
|
||||||
|
* dataType: string
|
||||||
|
* arbitrary: ["arg1","arg2"]
|
||||||
|
|
||||||
|
|
||||||
|
### `POST` /tests ###
|
||||||
|
|
||||||
|
_create test_
|
||||||
|
|
||||||
|
#### Parameters ####
|
||||||
|
|
||||||
|
a:
|
||||||
|
|
||||||
|
* type: string
|
||||||
|
* required: true
|
||||||
|
* description: A nice description
|
||||||
|
|
||||||
|
b:
|
||||||
|
|
||||||
|
* type: string
|
||||||
|
* required: true
|
||||||
|
MARKDOWN;
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
|
|
||||||
<phpunit
|
<phpunit
|
||||||
backupGlobals = "false"
|
backupGlobals = "false"
|
||||||
backupStaticAttributes = "false"
|
backupStaticAttributes = "false"
|
||||||
@ -11,10 +9,10 @@
|
|||||||
processIsolation = "false"
|
processIsolation = "false"
|
||||||
stopOnFailure = "false"
|
stopOnFailure = "false"
|
||||||
syntaxCheck = "false"
|
syntaxCheck = "false"
|
||||||
bootstrap = "Tests/bootstrap.php" >
|
bootstrap = "Tests/bootstrap.php">
|
||||||
|
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Project Test Suite">
|
<testsuite name="NelmioApiDocBundle Test Suite">
|
||||||
<directory>Tests</directory>
|
<directory>Tests</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user