Code Duplication    Length = 17-18 lines in 2 locations

tests/unit/Handler/BatchAcknowledgementHandlerTest.php 1 location

@@ 88-104 (lines=17) @@
85
        assertThat($msgs, is(identicalTo([$this->messageA, $this->messageC])));
86
    }
87
88
    public function testHandleWorkerWithThrownException()
89
    {
90
        $handler = $this->handler;
91
92
        $this->messageA->shouldReceive('isValid')->once()->withNoArgs()->andReturn(true);
93
        $this->messageB->shouldReceive('isValid')->once()->withNoArgs()->andReturn(true);
94
95
        $this->adapter->shouldReceive('acknowledge')->once()->with([$this->messageA]);
96
97
        $this->setExpectedException('RuntimeException', 'foo');
98
99
        $handler($this->messages, $this->adapter, function ($msg) {
100
            if ($msg === $this->messageB) {
101
                throw new RuntimeException('foo');
102
            }
103
        });
104
    }
105
}
106

tests/unit/Handler/EagerAcknowledgementHandlerTest.php 1 location

@@ 95-112 (lines=18) @@
92
        assertThat($msgs, is(identicalTo([$this->messageA, $this->messageC])));
93
    }
94
95
    public function testHandleWorkerWithThrownException()
96
    {
97
        $handler = $this->handler;
98
99
        $this->messageA->shouldReceive('isValid')->once()->withNoArgs()->andReturn(true);
100
        $this->messageB->shouldReceive('isValid')->once()->withNoArgs()->andReturn(true);
101
102
        // @see https://github.com/padraic/mockery/issues/331
103
        $this->adapter->shouldReceive('acknowledge')->once()->with(m::mustBe([$this->messageA]));
104
105
        $this->setExpectedException('RuntimeException', 'foo');
106
107
        $handler($this->messages, $this->adapter, function ($msg) {
108
            if ($msg === $this->messageB) {
109
                throw new RuntimeException('foo');
110
            }
111
        });
112
    }
113
}
114