Test FOSRestBundle support

This commit is contained in:
Guilhem N 2016-11-30 16:21:03 +01:00
parent f6f91562d9
commit da6527060f
No known key found for this signature in database
GPG Key ID: 9E5D2DB67BF054DD
2 changed files with 20 additions and 0 deletions

View File

@ -11,6 +11,8 @@
namespace EXSyst\Bundle\ApiDocBundle\Tests\Functional\Controller; namespace EXSyst\Bundle\ApiDocBundle\Tests\Functional\Controller;
use FOS\RestBundle\Controller\Annotations\QueryParam;
use FOS\RestBundle\Controller\Annotations\RequestParam;
use Nelmio\ApiDocBundle\Annotation\ApiDoc; use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
@ -26,6 +28,15 @@ class ApiController
{ {
} }
/**
* @Route("/fosrest", methods={"POST"})
* @QueryParam(name="foo")
* @RequestParam(name="bar")
*/
public function fosrestAction()
{
}
/** /**
* @Route("/nelmio/{foo}", methods={"POST"}) * @Route("/nelmio/{foo}", methods={"POST"})
* @ApiDoc( * @ApiDoc(

View File

@ -40,6 +40,15 @@ class FunctionalTest extends WebTestCase
$this->assertEquals('/foo/', $parameter->getFormat()); $this->assertEquals('/foo/', $parameter->getFormat());
} }
public function testFOSRestAction()
{
$operation = $this->getOperation('/api/fosrest', 'post');
$parameters = $operation->getParameters();
$this->assertTrue($parameters->has('foo', 'query'));
$this->assertTrue($parameters->has('bar', 'formData'));
}
public function testNelmioAction() public function testNelmioAction()
{ {
$operation = $this->getOperation('/api/nelmio/{foo}', 'post'); $operation = $this->getOperation('/api/nelmio/{foo}', 'post');