1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Cmobi\RabbitmqBundle\Worker\Test\Transport\Worker; |
4
|
|
|
|
5
|
|
|
use Cmobi\RabbitmqBundle\Tests\BaseTestCase; |
6
|
|
|
use Cmobi\RabbitmqBundle\Transport\Worker\WorkerQueueBag; |
7
|
|
|
|
8
|
|
View Code Duplication |
class WorkerQueueBagTest extends BaseTestCase |
|
|
|
|
9
|
|
|
{ |
10
|
|
|
public function testGetBasicQos() |
11
|
|
|
{ |
12
|
|
|
$queueBag = new WorkerQueueBag('test'); |
13
|
|
|
|
14
|
|
|
$this->assertEquals(1, $queueBag->getBasicQos()); |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
public function testGetQueueName() |
18
|
|
|
{ |
19
|
|
|
$queueBag = new WorkerQueueBag('test'); |
20
|
|
|
|
21
|
|
|
$this->assertEquals('test', $queueBag->getQueue()); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
public function testGetPassive() |
25
|
|
|
{ |
26
|
|
|
$queueBag = new WorkerQueueBag('test'); |
27
|
|
|
|
28
|
|
|
$this->assertEquals(false, $queueBag->getPassive()); |
29
|
|
|
} |
30
|
|
|
public function testGetDurable() |
31
|
|
|
{ |
32
|
|
|
$queueBag = new WorkerQueueBag('test'); |
33
|
|
|
|
34
|
|
|
$this->assertEquals(true, $queueBag->getDurable()); |
35
|
|
|
} |
36
|
|
|
public function testGetExclusive() |
37
|
|
|
{ |
38
|
|
|
$queueBag = new WorkerQueueBag('test'); |
39
|
|
|
|
40
|
|
|
$this->assertEquals(false, $queueBag->getExclusive()); |
41
|
|
|
} |
42
|
|
|
public function testGetAutoDelete() |
43
|
|
|
{ |
44
|
|
|
$queueBag = new WorkerQueueBag('test'); |
45
|
|
|
|
46
|
|
|
$this->assertEquals(false, $queueBag->getAutoDelete()); |
47
|
|
|
} |
48
|
|
|
public function testGetNoWait() |
49
|
|
|
{ |
50
|
|
|
$queueBag = new WorkerQueueBag('test'); |
51
|
|
|
|
52
|
|
|
$this->assertEquals(false, $queueBag->getNoWait()); |
53
|
|
|
} |
54
|
|
|
public function testGetArguments() |
55
|
|
|
{ |
56
|
|
|
$queueBag = new WorkerQueueBag('test'); |
57
|
|
|
|
58
|
|
|
$this->assertEquals(null, $queueBag->getArguments()); |
59
|
|
|
} |
60
|
|
|
public function testGetTicket() |
61
|
|
|
{ |
62
|
|
|
$queueBag = new WorkerQueueBag('test'); |
63
|
|
|
|
64
|
|
|
$this->assertEquals(null, $queueBag->getTicket()); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function testGetQueueDeclare() |
68
|
|
|
{ |
69
|
|
|
$queueBag = new WorkerQueueBag('test'); |
70
|
|
|
|
71
|
|
|
$this->assertEquals( |
72
|
|
|
[ |
73
|
|
|
'test', |
74
|
|
|
false, |
75
|
|
|
true, |
76
|
|
|
false, |
77
|
|
|
false, |
78
|
|
|
false, |
79
|
|
|
null, |
80
|
|
|
null, |
81
|
|
|
], |
82
|
|
|
$queueBag->getQueueDeclare() |
83
|
|
|
); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function testGetQueueConsume() |
87
|
|
|
{ |
88
|
|
|
$queueBag = new WorkerQueueBag('test'); |
89
|
|
|
|
90
|
|
|
$this->assertEquals( |
91
|
|
|
[ |
92
|
|
|
'test', |
93
|
|
|
'', |
94
|
|
|
false, |
95
|
|
|
false, |
96
|
|
|
false, |
97
|
|
|
false, |
98
|
|
|
null, |
99
|
|
|
null, |
100
|
|
|
], |
101
|
|
|
$queueBag->getQueueConsume() |
102
|
|
|
); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function testGetExchangeDeclare() |
106
|
|
|
{ |
107
|
|
|
$queueBag = new WorkerQueueBag('test'); |
108
|
|
|
|
109
|
|
|
$this->assertEquals(false, $queueBag->getExchangeDeclare()); |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
|
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.