|
|
|
@ -2,20 +2,7 @@ |
|
|
|
|
|
|
|
|
|
namespace Rinsvent\RequestBundle\Tests\Listener; |
|
|
|
|
|
|
|
|
|
use Rinsvent\RequestBundle\Tests\unit\Listener\fixtures\FillTest\Controller; |
|
|
|
|
use Rinsvent\RequestBundle\Tests\unit\Listener\fixtures\FillTest\HelloRequest; |
|
|
|
|
use Symfony\Component\EventDispatcher\EventDispatcher; |
|
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
|
|
|
use Symfony\Component\HttpFoundation\RequestStack; |
|
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
|
|
|
use Symfony\Component\HttpKernel\Controller\ArgumentResolver; |
|
|
|
|
use Symfony\Component\HttpKernel\Controller\ControllerResolver; |
|
|
|
|
use Symfony\Component\HttpKernel\EventListener\RouterListener; |
|
|
|
|
use Symfony\Component\HttpKernel\HttpKernel; |
|
|
|
|
use Symfony\Component\Routing\Matcher\UrlMatcher; |
|
|
|
|
use Symfony\Component\Routing\RequestContext; |
|
|
|
|
use Symfony\Component\Routing\Route; |
|
|
|
|
use Symfony\Component\Routing\RouteCollection; |
|
|
|
|
|
|
|
|
|
use Rinsvent\RequestBundle\EventListener\RequestListener; |
|
|
|
|
|
|
|
|
@ -42,6 +29,20 @@ class FillTest extends \Codeception\Test\Unit |
|
|
|
|
]); |
|
|
|
|
$response = $this->tester->send($request); |
|
|
|
|
|
|
|
|
|
$this->assertEquals(200, $response->getStatusCode()); |
|
|
|
|
$this->assertEquals('Surname', $request->get(RequestListener::REQUEST_DATA)->surname); |
|
|
|
|
$this->assertEquals('Hello igor', $response->getContent()); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testFailRequestData() |
|
|
|
|
{ |
|
|
|
|
$request = Request::create('/hello/igor', 'GET', [ |
|
|
|
|
'surname' => '' |
|
|
|
|
]); |
|
|
|
|
$response = $this->tester->send($request); |
|
|
|
|
|
|
|
|
|
$this->assertEquals(400, $response->getStatusCode()); |
|
|
|
|
$this->assertEquals('{"errors":[{"message":"This value should not be blank.","path":"surname"}]}', $response->getContent()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|