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

PusherDataFormatterTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 31
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A testFormat() 0 9 1
A assertValidDispatchData() 0 10 1
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
}