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 pathMulticastResultTest.php
71 lines (50 loc) · 2.27 KB
/
MulticastResultTest.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
<?php
namespace PHP_GCM;
class MulticastResultTest extends \PHPUnit_Framework_TestCase {
public function testConstructsCorrectly() {
$result = new MulticastResult(1, 2, 1, 'multicast-id', array());
$this->assertEquals('multicast-id', $result->getMulticastId());
$this->assertEquals(1, $result->getSuccess());
$this->assertEquals(3, $result->getTotal());
$this->assertEquals(2, $result->getFailure());
$this->assertEquals(1, $result->getCanonicalIds());
$this->assertTrue(is_array($result->getResults()) && empty($result->getResults()));
$this->assertTrue(is_array($result->getRetryMulticastIds()) && empty($result->getRetryMulticastIds()));
}
public function testAddResult() {
$result = new MulticastResult(1, 2, 1, 'multicast-id', array());
$this->assertTrue(is_array($result->getResults()) && empty($result->getResults()));
$result->addResult(new Result());
$this->assertTrue(is_array($result->getResults()) && count($result->getResults()) == 1);
}
public function testGetMulticastId() {
$result = new MulticastResult(1, 2, 1, 'multicast-id', array());
$this->assertEquals('multicast-id', $result->getMulticastId());
}
public function testGetSuccess() {
$result = new MulticastResult(1, 2, 1, 'multicast-id', array());
$this->assertEquals(1, $result->getSuccess());
}
public function testGetTotal() {
$result = new MulticastResult(1, 2, 1, 'multicast-id', array());
$this->assertEquals(3, $result->getTotal());
}
public function testGetFailure() {
$result = new MulticastResult(1, 2, 1, 'multicast-id', array());
$this->assertEquals(2, $result->getFailure());
}
public function testGetCanonicalIds() {
$result = new MulticastResult(1, 2, 1, 'multicast-id', array());
$this->assertEquals(1, $result->getCanonicalIds());
}
public function testGetResults() {
$result = new MulticastResult(1, 2, 1, 'multicast-id', array());
$result->addResult(new Result());
$this->assertTrue(is_array($result->getResults()));
$this->assertEquals(array(new Result()), $result->getResults());
}
public function testGetRetryMulticastIds() {
$result = new MulticastResult(1, 2, 1, 'multicast-id', array(1));
$this->assertEquals(array(1), $result->getRetryMulticastIds());
}
}