@@ 43-51 (lines=9) @@ | ||
40 | $this->client = new Client(new ArrayAdapter($this->messages)); |
|
41 | } |
|
42 | ||
43 | public function testReceive() |
|
44 | { |
|
45 | $msgs = []; |
|
46 | $this->client->receive(function ($msg) use (&$msgs) { |
|
47 | $msgs[] = $msg; |
|
48 | }, 100); |
|
49 | ||
50 | assertThat($msgs, is(identicalTo($this->messages))); |
|
51 | } |
|
52 | ||
53 | public function testReceiveWithPolling() |
|
54 | { |
|
@@ 53-61 (lines=9) @@ | ||
50 | assertThat($msgs, is(identicalTo($this->messages))); |
|
51 | } |
|
52 | ||
53 | public function testReceiveWithPolling() |
|
54 | { |
|
55 | $msgs = []; |
|
56 | $this->client->receive(function ($msg) use (&$msgs) { |
|
57 | $msgs[] = $msg; |
|
58 | }, null); |
|
59 | ||
60 | assertThat($msgs, is(identicalTo($this->messages))); |
|
61 | } |
|
62 | ||
63 | public function testReceiveWithNoMessages() |
|
64 | { |
|
@@ 92-102 (lines=11) @@ | ||
89 | $this->client->send([$this->client->create('foo')]); |
|
90 | } |
|
91 | ||
92 | public function testPurge() |
|
93 | { |
|
94 | $this->client->purge(); |
|
95 | ||
96 | $msgs = []; |
|
97 | $this->client->receive(function ($msg) use (&$msgs) { |
|
98 | $msgs[] = $msg; |
|
99 | }, null); |
|
100 | ||
101 | assertThat($msgs, is(emptyArray())); |
|
102 | } |
|
103 | ||
104 | public function testDelete() |
|
105 | { |
|
@@ 104-114 (lines=11) @@ | ||
101 | assertThat($msgs, is(emptyArray())); |
|
102 | } |
|
103 | ||
104 | public function testDelete() |
|
105 | { |
|
106 | $this->client->delete(); |
|
107 | ||
108 | $msgs = []; |
|
109 | $this->client->receive(function ($msg) use (&$msgs) { |
|
110 | $msgs[] = $msg; |
|
111 | }, null); |
|
112 | ||
113 | assertThat($msgs, is(emptyArray())); |
|
114 | } |
|
115 | } |
|
116 |