Completed
Push — master ( 705569...50fbec )
by dan
02:16
created

DefaultChannelTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 48
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A testFormat() 0 9 1
A testDispatch() 0 11 1
A testFormatAndDispatch() 0 12 1
1
<?php
2
3
namespace IrishDan\NotificationBundle\Test\Channel;
4
5
use IrishDan\NotificationBundle\Channel\DefaultChannel;
6
use IrishDan\NotificationBundle\Test\NotificationTestCase;
7
8
class DefaultChannelTest extends NotificationTestCase
9
{
10
    public $defaultChannel;
11
    protected $notification;
12
13
    public function setUp()
14
    {
15
        parent::setUp();
16
17
        $this->notification   = $this->getNotificationWithUser();
18
        $this->defaultChannel = new DefaultChannel();
19
    }
20
21
    public function testFormat()
22
    {
23
        $formatter = $this->getMockFormatter(true);
24
        $this->defaultChannel->setDataFormatter($formatter);
25
26
        $message = $this->defaultChannel->format($this->notification);
27
28
        $this->assertInstanceOf('IrishDan\NotificationBundle\Message\MessageInterface', $message);
29
    }
30
31
    public function testDispatch()
32
    {
33
        $message = $this->getTestMessage();
34
35
        $dispatcher = $this->getMockDispatcher(true);
36
        $this->defaultChannel->setDispatcher($dispatcher);
37
38
        $dispatched = $this->defaultChannel->dispatch($message);
39
40
        $this->assertTrue($dispatched);
41
    }
42
43
    public function testFormatAndDispatch()
44
    {
45
        $formatter = $this->getMockFormatter(true);
46
        $this->defaultChannel->setDataFormatter($formatter);
47
48
        $dispatcher = $this->getMockDispatcher(true);
49
        $this->defaultChannel->setDispatcher($dispatcher);
50
51
        $dispatched = $this->defaultChannel->formatAndDispatch($this->notification);
52
53
        $this->assertTrue($dispatched);
54
    }
55
}
56