This repository was archived by the owner on Oct 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathNotificationTest.php
116 lines (85 loc) · 3.48 KB
/
NotificationTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
namespace PHP_GCM;
class NotificationTest extends \PHPUnit_Framework_TestCase {
protected $notification;
protected function setUp() {
$this->notification = new Notification();
}
public function testConstructsCorrectly() {
$this->assertEquals('default', $this->notification->getSound());
}
public function testSetsIcon() {
$this->notification->icon('icon');
$this->assertEquals('icon', $this->notification->getIcon());
}
public function testSetsSound() {
$this->notification->sound('sound');
$this->assertEquals('sound', $this->notification->getSound());
}
public function testSetsTitle() {
$this->notification->title('title');
$this->assertEquals('title', $this->notification->getTitle());
}
public function testSetsBody() {
$this->notification->body('body');
$this->assertEquals('body', $this->notification->getBody());
}
public function testSetsBadge() {
$this->notification->badge(1);
$this->assertEquals(1, $this->notification->getBadge());
}
public function testSetsTag() {
$this->notification->tag('tag');
$this->assertEquals('tag', $this->notification->getTag());
}
public function testSetsColor() {
$this->notification->color('color');
$this->assertEquals('color', $this->notification->getColor());
}
public function testSetsClickAction() {
$this->notification->clickAction('click-action');
$this->assertEquals('click-action', $this->notification->getClickAction());
}
public function testSetsBodyLocKey() {
$this->notification->bodyLocKey('bodyLocKey');
$this->assertEquals('bodyLocKey', $this->notification->getBodyLocKey());
}
public function testSetsBodyLocArgs() {
$this->notification->bodyLocArgs(array('key' => 'value'));
$this->assertEquals(array('key' => 'value'), $this->notification->getBodyLocArgs());
}
public function testSetsTitleLocKey() {
$this->notification->titleLocKey('titleLocKey');
$this->assertEquals('titleLocKey', $this->notification->getTitleLocKey());
}
public function testSetsTitleLocArgs() {
$this->notification->titleLocArgs(array('key' => 'value'));
$this->assertEquals(array('key' => 'value'), $this->notification->getTitleLocArgs());
}
public function testSettersAreChainable() {
$this->notification->icon('icon')
->sound('sound')
->title('title')
->body('body')
->badge(1)
->tag('tag')
->color('color')
->clickAction('click-action')
->bodyLocKey('bodyLocKey')
->bodyLocArgs(array('key' => 'value'))
->titleLocKey('titleLocKey')
->titleLocArgs(array('key' => 'value'));
$this->assertEquals('icon', $this->notification->getIcon());
$this->assertEquals('sound', $this->notification->getSound());
$this->assertEquals('title', $this->notification->getTitle());
$this->assertEquals('body', $this->notification->getBody());
$this->assertEquals(1, $this->notification->getBadge());
$this->assertEquals('tag', $this->notification->getTag());
$this->assertEquals('color', $this->notification->getColor());
$this->assertEquals('click-action', $this->notification->getClickAction());
$this->assertEquals('bodyLocKey', $this->notification->getBodyLocKey());
$this->assertEquals(array('key' => 'value'), $this->notification->getBodyLocArgs());
$this->assertEquals('titleLocKey', $this->notification->getTitleLocKey());
$this->assertEquals(array('key' => 'value'), $this->notification->getTitleLocArgs());
}
}