@@ 53-67 (lines=15) @@ | ||
50 | $this->handler = new NullAcknowledgementHandler(); |
|
51 | } |
|
52 | ||
53 | public function testHandle() |
|
54 | { |
|
55 | $handler = $this->handler; |
|
56 | ||
57 | $this->messageA->shouldReceive('isValid')->once()->withNoArgs()->andReturn(true); |
|
58 | $this->messageB->shouldReceive('isValid')->once()->withNoArgs()->andReturn(true); |
|
59 | $this->messageC->shouldReceive('isValid')->once()->withNoArgs()->andReturn(true); |
|
60 | ||
61 | $msgs = []; |
|
62 | $handler($this->messages, $this->adapter, function ($msg) use (&$msgs) { |
|
63 | $msgs[] = $msg; |
|
64 | }); |
|
65 | ||
66 | assertThat($msgs, is(identicalTo(iterator_to_array($this->messages)))); |
|
67 | } |
|
68 | ||
69 | public function testHandleInvalidMessage() |
|
70 | { |
|
@@ 69-83 (lines=15) @@ | ||
66 | assertThat($msgs, is(identicalTo(iterator_to_array($this->messages)))); |
|
67 | } |
|
68 | ||
69 | public function testHandleInvalidMessage() |
|
70 | { |
|
71 | $handler = $this->handler; |
|
72 | ||
73 | $this->messageA->shouldReceive('isValid')->once()->withNoArgs()->andReturn(true); |
|
74 | $this->messageB->shouldReceive('isValid')->once()->withNoArgs()->andReturn(false); |
|
75 | $this->messageC->shouldReceive('isValid')->once()->withNoArgs()->andReturn(true); |
|
76 | ||
77 | $msgs = []; |
|
78 | $handler($this->messages, $this->adapter, function ($msg) use (&$msgs) { |
|
79 | $msgs[] = $msg; |
|
80 | }); |
|
81 | ||
82 | assertThat($msgs, is(identicalTo([$this->messageA, $this->messageC]))); |
|
83 | } |
|
84 | ||
85 | public function testHandleWorkerWithThrownException() |
|
86 | { |