* * 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'); set_error_handler(array($this, 'handleDeprecation')); $data = $extractor->all(); restore_error_handler(); $result = $container->get('nelmio_api_doc.formatter.markdown_formatter')->format($data); $expected = <<=0.2 nested[until]: * type: string * versions: <=0.3 nested[since_and_until]: * type: string * versions: >=0.4,<=0.5 nested_array[]: * type: array of objects (JmsNested) ### `ANY` /secure-route ### #### Requirements #### **_scheme** - Requirement: https ### `ANY` /yet-another/{id} ### #### Requirements #### **id** - Requirement: \\d+ ### `GET` /z-action-with-deprecated-indicator ### ### This method is deprecated ### ### `GET` /z-action-with-query-param ### #### Filters #### page: * Requirement: \\d+ * Description: Page of the overview. * Default: 1 ### `GET` /z-action-with-query-param-no-default ### #### Filters #### page: * Requirement: \d+ * Description: Page of the overview. ### `GET` /z-action-with-query-param-strict ### #### Requirements #### **page** - Requirement: \d+ - Description: Page of the overview. ### `POST` /z-action-with-request-param ### #### Parameters #### param1: * type: string * required: true * description: Param1 description. ### `ANY` /z-return-jms-and-validator-output ### #### Response #### bar: * type: DateTime objects[]: * type: array of objects (Test) objects[][a]: * type: string objects[][b]: * type: DateTime number: * type: DateTime MARKDOWN; $this->assertEquals($expected, $result); } public function testFormatOne() { $container = $this->getContainer(); $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); $annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::indexAction', 'test_route_1'); $result = $container->get('nelmio_api_doc.formatter.markdown_formatter')->formatOne($annotation); $expected = <<assertEquals($expected, $result); } }