|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the login-cidadao project or it's bundles. |
|
4
|
|
|
* |
|
5
|
|
|
* (c) Guilherme Donato <guilhermednt on github> |
|
6
|
|
|
* |
|
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
8
|
|
|
* file that was distributed with this source code. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace PROCERGS\LoginCidadao\NfgBundle\Tests\Event; |
|
12
|
|
|
|
|
13
|
|
|
use PHPUnit\Framework\TestCase; |
|
14
|
|
|
use PROCERGS\LoginCidadao\NfgBundle\Event\GetConnectCallbackResponseEvent; |
|
15
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
16
|
|
|
|
|
17
|
|
|
class GetConnectCallbackResponseEventTest extends TestCase |
|
18
|
|
|
{ |
|
19
|
|
|
public function testEvent() |
|
20
|
|
|
{ |
|
21
|
|
|
$request = $this->createMock('Symfony\Component\HttpFoundation\Request'); |
|
22
|
|
|
$personMeuRS = $this->createMock('PROCERGS\LoginCidadao\CoreBundle\Entity\PersonMeuRS'); |
|
23
|
|
|
$overrideExisting = true; |
|
24
|
|
|
$response = $this->createMock('Symfony\Component\HttpFoundation\Response'); |
|
25
|
|
|
|
|
26
|
|
|
$event = new GetConnectCallbackResponseEvent($request, $personMeuRS, $overrideExisting, $response); |
|
27
|
|
|
|
|
28
|
|
|
$this->assertEquals($request, $event->getRequest()); |
|
29
|
|
|
$this->assertEquals($personMeuRS, $event->getPersonMeuRS()); |
|
30
|
|
|
$this->assertEquals($overrideExisting, $event->isOverrideExisting()); |
|
31
|
|
|
$this->assertEquals($response, $event->getResponse()); |
|
32
|
|
|
|
|
33
|
|
|
$newResponse = new Response('content'); |
|
34
|
|
|
$event->setResponse($newResponse); |
|
35
|
|
|
|
|
36
|
|
|
$this->assertEquals($newResponse, $event->getResponse()); |
|
37
|
|
|
} |
|
38
|
|
|
} |
|
39
|
|
|
|