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

Test/NotificationManagerTest.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace IrishDan\NotificationBundle\Test;
4
5
use IrishDan\NotificationBundle\ChannelManager;
6
use IrishDan\NotificationBundle\DatabaseNotificationManager;
7
use IrishDan\NotificationBundle\NotificationManager;
8
use IrishDan\NotificationBundle\Test\Notification\TestNotification;
9
10
class NotificationManagerTest extends NotificationTestCase
11
{
12
    protected $manager;
13
    protected $channelManager;
14
    protected $databaseManager;
15
    protected $notification;
16
17
    public function setUp()
18
    {
19
        parent::setUp();
20
21
        $this->channelManager = $this->getMockBuilder(ChannelManager::class)
22
            ->disableOriginalConstructor()
23
            ->getMock();
24
25
        $this->databaseManager = $this->getMockBuilder(DatabaseNotificationManager::class)
26
            ->disableOriginalConstructor()
27
            ->getMock();
28
29
        $this->manager = new NotificationManager($this->channelManager);
30
31
        $this->notification = new TestNotification();
32
    }
33
34 View Code Duplication
    public function testSend()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
35
    {
36
        $recipient = $this->getTestUser();
37
38
        $this->channelManager->expects($this->once())
39
            ->method('send');
40
41
        $this->manager->send($this->notification, $recipient);
42
    }
43
44 View Code Duplication
    public function testSendMultiple()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
45
    {
46
        $recipient = $this->getTestUser();
47
48
        $this->channelManager->expects($this->any())
49
            ->method('send');
50
51
        $this->manager->send($this->notification, [$recipient, $recipient]);
52
    }
53
54
    public function testSendWitData()
55
    {
56
        $recipient = $this->getTestUser();
57
58
        $this->channelManager->expects($this->any())
59
            ->method('send');
60
61
        $this->manager->send($this->notification, [$recipient, $recipient], ['extra_data' => 'test_data']);
62
63
        $data = $this->notification->getDataArray();
64
65
        $this->assertArrayHasKey('body', $data);
66
        $this->assertArrayHasKey('title', $data);
67
        $this->assertArrayHasKey('extra_data', $data);
68
        $this->assertEquals('test_data', $data['extra_data']);
69
    }
70
71
    public function testMarkAsRead()
72
    {
73
    }
74
75
    public function testMarkAllAsRead()
76
    {
77
78
    }
79
80
    public function testAllNotificationCount()
81
    {
82
    }
83
84
    public function testUnreadNotificationCount()
85
    {
86
    }
87
88
    public function testReadNotificationCount(NotifiableInterface $user)
0 ignored issues
show
The parameter $user is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
89
    {
90
    }
91
92
    public function testNotificationCount()
93
    {
94
    }
95
}