Completed
Push — master ( 13aa34...cd8958 )
by dan
02:19
created

PusherDataFormatterTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace IrishDan\NotificationBundle\Formatter;
4
5
use IrishDan\NotificationBundle\Message\MessageInterface;
6
use IrishDan\NotificationBundle\Test\Formatter\FormatterTestCase;
7
8
class PusherDataFormatterTest extends FormatterTestCase
9
{
10
    public function setUp()
11
    {
12
        parent::setUp();
13
14
        $pusherManager   = $this->getService('notification.pusher_manager');
15
        $this->formatter = new PusherDataFormatter($pusherManager);
16
    }
17
18
    public function testFormat()
19
    {
20
        $message = $this->formatter->format($this->notification);
21
22
        $this->assertValidDispatchData($message);
23
        $this->assertMessageDataStructure($message);
24
25
        $this->assertBasicMessageData($message);
26
    }
27
28
    public function assertValidDispatchData(MessageInterface $message)
29
    {
30
        $this->assertEquals('pusher', $message->getChannel());
31
32
        $dispatchData = $message->getDispatchData();
33
        $this->assertArrayHasKey('channel', $dispatchData);
34
35
        $this->assertEquals('pusher_test_1', $dispatchData['channel']);
36
        $this->assertEquals('pusher_event', $dispatchData['event']);
37
    }
38
}