Completed
Push — master ( 157467...db6785 )
by Artem
28:48
created

SymfonyEventDispatcherTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 7
dl 0
loc 26
rs 10
1
<?php
2
/*
3
 * This file is part of the FirebaseCloudMessagingBundle
4
 *
5
 * (c) Artem Henvald <[email protected]>
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 Fresh\FirebaseCloudMessagingBundle\Tests\Event;
12
13
use Fresh\FirebaseCloudMessaging\Event\FirebaseEvents;
14
use Fresh\FirebaseCloudMessaging\Event\MulticastMessageResponseEvent;
15
use Fresh\FirebaseCloudMessaging\Response\MessageResult\Collection\CanonicalTokenMessageResultCollection;
16
use Fresh\FirebaseCloudMessaging\Response\MessageResult\Collection\FailedMessageResultCollection;
17
use Fresh\FirebaseCloudMessaging\Response\MessageResult\Collection\SuccessfulMessageResultCollection;
18
use Fresh\FirebaseCloudMessagingBundle\Event\SymfonyEventDispatcher;
19
use PHPUnit\Framework\TestCase;
20
use Symfony\Component\EventDispatcher\EventDispatcherInterface as SymfonyEventDispatcherInterface;
21
22
/**
23
 * SymfonyEventDispatcherTest.
24
 *
25
 * @author Artem Henvald <[email protected]>
26
 */
27
class SymfonyEventDispatcherTest extends TestCase
28
{
29
    public function testDispatchMethod()
30
    {
31
        /** @var SymfonyEventDispatcherInterface|\PHPUnit_Framework_MockObject_MockObject $eventDispatcher */
32
        $eventDispatcher = $this->getMockBuilder(SymfonyEventDispatcherInterface::class)
33
                                ->disableOriginalConstructor()
34
                                ->getMock();
35
36
        $eventDispatcher->expects($this->once())
37
                        ->method('dispatch');
38
39
        $eventData = new MulticastMessageResponseEvent(
40
            1234567890,
41
            new SuccessfulMessageResultCollection(),
42
            new FailedMessageResultCollection(),
43
            new CanonicalTokenMessageResultCollection()
44
        );
45
46
        $symfonyEventDispatcher = new SymfonyEventDispatcher($eventDispatcher);
47
        $symfonyEventDispatcher->dispatch(
48
            FirebaseEvents::MULTICAST_MESSAGE_RESPONSE_EVENT,
49
            $eventData
50
        );
51
    }
52
}
53