1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Cmobi\RabbitmqBundle\Tests\Rpc; |
4
|
|
|
|
5
|
|
|
use Cmobi\RabbitmqBundle\Transport\Rpc\RpcQueueBag; |
6
|
|
|
use Cmobi\RabbitmqBundle\Tests\BaseTestCase; |
7
|
|
|
|
8
|
|
View Code Duplication |
class RpcQueueBagTest extends BaseTestCase |
|
|
|
|
9
|
|
|
{ |
10
|
|
|
public function testGetBasicQos() |
11
|
|
|
{ |
12
|
|
|
$queueBag = new RpcQueueBag('test'); |
13
|
|
|
|
14
|
|
|
$this->assertEquals(1, $queueBag->getBasicQos()); |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
public function testGetQueueName() |
18
|
|
|
{ |
19
|
|
|
$queueBag = new RpcQueueBag('test'); |
20
|
|
|
|
21
|
|
|
$this->assertEquals('test', $queueBag->getQueue()); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
public function testGetPassive() |
25
|
|
|
{ |
26
|
|
|
$queueBag = new RpcQueueBag('test'); |
27
|
|
|
|
28
|
|
|
$this->assertEquals(false, $queueBag->getPassive()); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function testGetDurable() |
32
|
|
|
{ |
33
|
|
|
$queueBag = new RpcQueueBag('test'); |
34
|
|
|
|
35
|
|
|
$this->assertEquals(false, $queueBag->getDurable()); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function testGetExclusive() |
39
|
|
|
{ |
40
|
|
|
$queueBag = new RpcQueueBag('test'); |
41
|
|
|
|
42
|
|
|
$this->assertEquals(false, $queueBag->getExclusive()); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function testGetAutoDelete() |
46
|
|
|
{ |
47
|
|
|
$queueBag = new RpcQueueBag('test'); |
48
|
|
|
|
49
|
|
|
$this->assertEquals(true, $queueBag->getAutoDelete()); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function testGetNoWait() |
53
|
|
|
{ |
54
|
|
|
$queueBag = new RpcQueueBag('test'); |
55
|
|
|
|
56
|
|
|
$this->assertEquals(false, $queueBag->getNoWait()); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function testGetArguments() |
60
|
|
|
{ |
61
|
|
|
$queueBag = new RpcQueueBag('test'); |
62
|
|
|
|
63
|
|
|
$this->assertEquals(null, $queueBag->getArguments()); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function testGetTicket() |
67
|
|
|
{ |
68
|
|
|
$queueBag = new RpcQueueBag('test'); |
69
|
|
|
|
70
|
|
|
$this->assertEquals(null, $queueBag->getTicket()); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function testGetQueueDeclare() |
74
|
|
|
{ |
75
|
|
|
$queueBag = new RpcQueueBag('test'); |
76
|
|
|
|
77
|
|
|
$this->assertEquals( |
78
|
|
|
[ |
79
|
|
|
'test', |
80
|
|
|
false, |
81
|
|
|
false, |
82
|
|
|
false, |
83
|
|
|
true, |
84
|
|
|
false, |
85
|
|
|
null, |
86
|
|
|
null, |
87
|
|
|
], |
88
|
|
|
$queueBag->getQueueDeclare() |
89
|
|
|
); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function testGetQueueConsume() |
93
|
|
|
{ |
94
|
|
|
$queueBag = new RpcQueueBag('test'); |
95
|
|
|
|
96
|
|
|
$this->assertEquals( |
97
|
|
|
[ |
98
|
|
|
'test', |
99
|
|
|
'', |
100
|
|
|
false, |
101
|
|
|
false, |
102
|
|
|
false, |
103
|
|
|
false, |
104
|
|
|
null, |
105
|
|
|
null, |
106
|
|
|
], |
107
|
|
|
$queueBag->getQueueConsume() |
108
|
|
|
); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
public function testGetExchangeDeclare() |
112
|
|
|
{ |
113
|
|
|
$queueBag = new RpcQueueBag('test'); |
114
|
|
|
|
115
|
|
|
$this->assertEquals(false, $queueBag->getExchangeDeclare()); |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.