Completed
Push — master ( e7a3c7...2372b5 )
by dan
02:03
created

BroadcasterTest::testBroadcast()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 8.9713
c 0
b 0
f 0
cc 1
eloc 18
nc 1
nop 0
1
<?php
2
3
namespace IrishDan\NotificationBundle\Test\Broadcast;
4
5
use IrishDan\NotificationBundle\Broadcast\Broadcast;
6
use IrishDan\NotificationBundle\Broadcast\Broadcaster;
7
use IrishDan\NotificationBundle\Channel\ChannelInterface;
8
use IrishDan\NotificationBundle\Notification\NotificationInterface;
9
use IrishDan\NotificationBundle\Test\NotificationTestCase;
10
11
class BroadcasterTest extends NotificationTestCase
12
{
13
    public function testBroadcast()
14
    {
15
        $notifiable = new Broadcast();
16
        $configuration = [
17
            'webhook' => 'http://slack.com/',
18
            'pusher_channel' => 'test_channel',
19
        ];
20
21
        $channel = $this->getMockBuilder(ChannelInterface::class)
22
            ->setMethods(['channelName', 'setDispatchToEvent', 'formatAndDispatch'])
23
            ->disableOriginalConstructor()
24
            ->getMock();
25
        $channel->expects($this->once())->method('channelName');
26
        $channel->expects($this->once())->method('setDispatchToEvent');
27
        $channel->expects($this->once())->method('formatAndDispatch');
28
29
        $notification = $this->getMockBuilder(NotificationInterface::class)
30
            ->disableOriginalConstructor()
31
            ->getMock();
32
        $notification->expects($this->once())->method('setNotifiable');
33
34
        $broadcaster = new Broadcaster($notifiable, $channel, $configuration);
35
        $broadcaster->broadcast($notification);
36
    }
37
}