1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of graze/queue. |
5
|
|
|
* |
6
|
|
|
* Copyright (c) 2015 Nature Delivered Ltd. <https://www.graze.com> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* @license https://github.com/graze/queue/blob/master/LICENSE MIT |
12
|
|
|
* |
13
|
|
|
* @link https://github.com/graze/queue |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace Graze\Queue\Adapter\Exception; |
17
|
|
|
|
18
|
|
|
use Exception; |
19
|
|
|
use Graze\Queue\Adapter\AdapterInterface; |
20
|
|
|
use Graze\Queue\Message\MessageInterface; |
21
|
|
|
use Mockery as m; |
22
|
|
|
use Mockery\MockInterface; |
23
|
|
|
use Graze\Queue\Test\TestCase; |
24
|
|
|
|
25
|
|
|
class MethodNotSupportedExceptionTest 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 MethodNotSupportedException */ |
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 MethodNotSupportedException( |
51
|
|
|
'method', |
52
|
|
|
$this->adapter, |
|
|
|
|
53
|
|
|
$this->messages, |
54
|
|
|
$this->debug, |
55
|
|
|
$this->previous |
56
|
|
|
); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function testInterface() |
60
|
|
|
{ |
61
|
|
|
assertThat($this->exception, is(anInstanceOf(AdapterException::class))); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function testGetMethod() |
65
|
|
|
{ |
66
|
|
|
assertThat($this->exception->getMethod(), is(identicalTo('method'))); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function testGetAdapter() |
70
|
|
|
{ |
71
|
|
|
assertThat($this->exception->getAdapter(), is(identicalTo($this->adapter))); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function testGetDebug() |
75
|
|
|
{ |
76
|
|
|
assertThat($this->exception->getDebug(), is(identicalTo($this->debug))); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function testGetMessages() |
80
|
|
|
{ |
81
|
|
|
assertThat($this->exception->getMessages(), is(identicalTo($this->messages))); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function testGetPrevious() |
85
|
|
|
{ |
86
|
|
|
assertThat($this->exception->getPrevious(), is(identicalTo($this->previous))); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|