mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Add test for event listener
This commit is contained in:
parent
ff2e1b23dd
commit
d86783ca91
28
Tests/EventListener/RequestListenerTest.php
Normal file
28
Tests/EventListener/RequestListenerTest.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?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\EventListener;
|
||||||
|
|
||||||
|
use Nelmio\ApiDocBundle\Tests\WebTestCase;
|
||||||
|
|
||||||
|
class RequestListenerTest extends WebTestCase
|
||||||
|
{
|
||||||
|
public function testDocQueryArg()
|
||||||
|
{
|
||||||
|
$client = $this->createClient();
|
||||||
|
|
||||||
|
$crawler = $client->request('GET', '/tests?_doc=1');
|
||||||
|
$this->assertEquals('/tests', trim($crawler->filter(".operation .path:contains('/tests')")->text()), 'Event listener should capture ?_doc=1 requests');
|
||||||
|
|
||||||
|
$client->request('GET', '/tests');
|
||||||
|
$this->assertEquals('tests', $client->getResponse()->getContent(), 'Event listener should let normal requests through');
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,7 @@
|
|||||||
namespace Nelmio\ApiDocBundle\Tests\Fixtures\Controller;
|
namespace Nelmio\ApiDocBundle\Tests\Fixtures\Controller;
|
||||||
|
|
||||||
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
class TestController
|
class TestController
|
||||||
{
|
{
|
||||||
@ -27,6 +28,7 @@ class TestController
|
|||||||
*/
|
*/
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
|
return new Response('tests');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user