| @@ 25-81 (lines=57) @@ | ||
| 22 | use Mockery\MockInterface; |
|
| 23 | use PHPUnit_Framework_TestCase as TestCase; |
|
| 24 | ||
| 25 | class FailedAcknowledgementExceptionTest extends TestCase |
|
| 26 | { |
|
| 27 | /** @var AdapterInterface|MockInterface */ |
|
| 28 | private $adapter; |
|
| 29 | /** @var array */ |
|
| 30 | private $debug; |
|
| 31 | /** @var MessageInterface[]|MockInterface[] */ |
|
| 32 | private $messages; |
|
| 33 | /** @var Exception */ |
|
| 34 | private $previous; |
|
| 35 | /** @var FailedAcknowledgementException */ |
|
| 36 | private $exception; |
|
| 37 | ||
| 38 | public function setUp() |
|
| 39 | { |
|
| 40 | $this->adapter = m::mock(AdapterInterface::class); |
|
| 41 | $this->debug = ['foo' => 'bar']; |
|
| 42 | ||
| 43 | $a = m::mock(MessageInterface::class); |
|
| 44 | $b = m::mock(MessageInterface::class); |
|
| 45 | $c = m::mock(MessageInterface::class); |
|
| 46 | $this->messages = [$a, $b, $c]; |
|
| 47 | ||
| 48 | $this->previous = new Exception(); |
|
| 49 | ||
| 50 | $this->exception = new FailedAcknowledgementException( |
|
| 51 | $this->adapter, |
|
| 52 | $this->messages, |
|
| 53 | $this->debug, |
|
| 54 | $this->previous); |
|
| 55 | } |
|
| 56 | ||
| 57 | public function testInterface() |
|
| 58 | { |
|
| 59 | assertThat($this->exception, is(anInstanceOf(AdapterException::class))); |
|
| 60 | } |
|
| 61 | ||
| 62 | public function testGetAdapter() |
|
| 63 | { |
|
| 64 | assertThat($this->exception->getAdapter(), is(identicalTo($this->adapter))); |
|
| 65 | } |
|
| 66 | ||
| 67 | public function testGetDebug() |
|
| 68 | { |
|
| 69 | assertThat($this->exception->getDebug(), is(identicalTo($this->debug))); |
|
| 70 | } |
|
| 71 | ||
| 72 | public function testGetMessages() |
|
| 73 | { |
|
| 74 | assertThat($this->exception->getMessages(), is(identicalTo($this->messages))); |
|
| 75 | } |
|
| 76 | ||
| 77 | public function testGetPrevious() |
|
| 78 | { |
|
| 79 | assertThat($this->exception->getPrevious(), is(identicalTo($this->previous))); |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||
| @@ 25-76 (lines=52) @@ | ||
| 22 | use Mockery\MockInterface; |
|
| 23 | use PHPUnit_Framework_TestCase as TestCase; |
|
| 24 | ||
| 25 | class FailedEnqueueExceptionTest extends TestCase |
|
| 26 | { |
|
| 27 | /** @var AdapterInterface|MockInterface */ |
|
| 28 | private $adapter; |
|
| 29 | /** @var array */ |
|
| 30 | private $debug; |
|
| 31 | /** @var MessageInterface[]|MockInterface[] */ |
|
| 32 | private $messages; |
|
| 33 | /** @var Exception */ |
|
| 34 | private $previous; |
|
| 35 | /** @var FailedEnqueueException */ |
|
| 36 | private $exception; |
|
| 37 | ||
| 38 | public function setUp() |
|
| 39 | { |
|
| 40 | $this->adapter = m::mock(AdapterInterface::class); |
|
| 41 | $this->debug = ['foo' => 'bar']; |
|
| 42 | ||
| 43 | $a = m::mock(MessageInterface::class); |
|
| 44 | $b = m::mock(MessageInterface::class); |
|
| 45 | $c = m::mock(MessageInterface::class); |
|
| 46 | $this->messages = [$a, $b, $c]; |
|
| 47 | ||
| 48 | $this->previous = new Exception(); |
|
| 49 | $this->exception = new FailedEnqueueException($this->adapter, $this->messages, $this->debug, $this->previous); |
|
| 50 | } |
|
| 51 | ||
| 52 | public function testInterface() |
|
| 53 | { |
|
| 54 | assertThat($this->exception, is(anInstanceOf(AdapterException::class))); |
|
| 55 | } |
|
| 56 | ||
| 57 | public function testGetAdapter() |
|
| 58 | { |
|
| 59 | assertThat($this->exception->getAdapter(), is(identicalTo($this->adapter))); |
|
| 60 | } |
|
| 61 | ||
| 62 | public function testGetDebug() |
|
| 63 | { |
|
| 64 | assertThat($this->exception->getDebug(), is(identicalTo($this->debug))); |
|
| 65 | } |
|
| 66 | ||
| 67 | public function testGetMessages() |
|
| 68 | { |
|
| 69 | assertThat($this->exception->getMessages(), is(identicalTo($this->messages))); |
|
| 70 | } |
|
| 71 | ||
| 72 | public function testGetPrevious() |
|
| 73 | { |
|
| 74 | assertThat($this->exception->getPrevious(), is(identicalTo($this->previous))); |
|
| 75 | } |
|
| 76 | } |
|
| 77 | ||