NelmioApiDocBundle/Tests/Formatter/SimpleFormatterTest.php

55 lines
1.6 KiB
PHP

<?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\DataTypes;
use Nelmio\ApiDocBundle\Tests\WebTestCase;
class SimpleFormatterTest extends WebTestCase
{
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.simple_formatter')->formatOne($annotation);
$expected = array(
'method' => 'GET',
'uri' => '/tests.{_format}',
'filters' => array(
'a' => array(
'dataType' => 'integer',
),
'b' => array(
'dataType' => 'string',
'arbitrary' => array(
'arg1',
'arg2',
),
),
),
'description' => 'index action',
'requirements' => array(
'_format' => array('dataType' => '', 'description' => '', 'requirement' => ''),
),
'https' => false,
'authentication' => false,
'authenticationRoles' => array(),
'deprecated' => false,
);
$this->assertEquals($expected, $result);
}
}