Completed
Push — master ( 248a24...bb02de )
by Daniel
02:42
created

SubscriberQueueBagTest::testGetQueue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Cmobi\RabbitmqBundle\Tests\Rpc;
4
5
use Cmobi\RabbitmqBundle\Transport\PubSub\ExchangeType;
6
use Cmobi\RabbitmqBundle\Transport\PubSub\SubscriberQueueBag;
7
use Cmobi\RabbitmqBundle\Tests\BaseTestCase;
8
9
class SubscriberQueueBagTest extends BaseTestCase
10
{
11
    public function testGetQueue()
12
    {
13
        $queueBag = new SubscriberQueueBag('excharge1', ExchangeType::FANOUT, 'test');
14
15
        $this->assertEquals('test', $queueBag->getQueue());
16
    }
17
18
    public function testGetType()
19
    {
20
        $queueBag = new SubscriberQueueBag('test', ExchangeType::TOPIC);
21
22
        $this->assertEquals(ExchangeType::TOPIC, $queueBag->getType());
23
    }
24
25
    public function testGetPassive()
26
    {
27
        $queueBag = new SubscriberQueueBag('test');
28
29
        $this->assertEquals(false, $queueBag->getPassive());
30
    }
31
32
    public function testGetDurable()
33
    {
34
        $queueBag = new SubscriberQueueBag('test');
35
36
        $this->assertEquals(false, $queueBag->getDurable());
37
    }
38
39
    public function testGetAutoDelete()
40
    {
41
        $queueBag = new SubscriberQueueBag('test');
42
43
        $this->assertEquals(false, $queueBag->getAutoDelete());
44
    }
45
46
    public function testGetNoAck()
47
    {
48
        $queueBag = new SubscriberQueueBag('test');
49
50
        $this->assertEquals(true, $queueBag->getNoAck());
51
    }
52
53
    public function testGetNoLocal()
54
    {
55
        $queueBag = new SubscriberQueueBag('test');
56
57
        $this->assertEquals(false, $queueBag->getNoLocal());
58
    }
59
60
    public function testGetNoWait()
61
    {
62
        $queueBag = new SubscriberQueueBag('test');
63
64
        $this->assertEquals(false, $queueBag->getNoWait());
65
    }
66
    public function testGetArguments()
67
    {
68
        $queueBag = new SubscriberQueueBag('test');
69
70
        $this->assertEquals(null, $queueBag->getArguments());
71
    }
72
    public function testGetTicket()
73
    {
74
        $queueBag = new SubscriberQueueBag('test');
75
76
        $this->assertEquals(null, $queueBag->getTicket());
77
    }
78
79
    public function testGetQueueDeclare()
80
    {
81
        $queueBag = new SubscriberQueueBag('test');
82
83
        $this->assertEquals(
84
            [
85
                '',
86
                false,
87
                false,
88
                true,
89
                false,
90
                false,
91
                null,
92
                null,
93
            ],
94
            $queueBag->getQueueDeclare()
95
        );
96
    }
97
98
    public function testGetQueueConsume()
99
    {
100
        $queueBag = new SubscriberQueueBag('test');
101
102
        $this->assertEquals(
103
            [
104
                '',
105
                '',
106
                false,
107
                true,
108
                false,
109
                false,
110
                null,
111
                null,
112
            ],
113
            $queueBag->getQueueConsume()
114
        );
115
    }
116
117 View Code Duplication
    public function testGetExchangeDeclare()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

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.

Loading history...
118
    {
119
        $queueBag = new SubscriberQueueBag('test', ExchangeType::DIRECT);
120
121
        $this->assertEquals(
122
            [
123
                'test',
124
                ExchangeType::DIRECT,
125
                false,
126
                false,
127
                false,
128
                false,
129
                false,
130
                null,
131
                null,
132
            ],
133
            $queueBag->getExchangeDeclare()
134
        );
135
    }
136
137 View Code Duplication
    public function testBadTypeInGetExchangeDeclare()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

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.

Loading history...
138
    {
139
        $queueBag = new SubscriberQueueBag('test', ExchangeType::DIRECT);
140
141
        $this->assertNotEquals(
142
            [
143
                'test',
144
                ExchangeType::FANOUT,
145
                false,
146
                false,
147
                false,
148
                false,
149
                false,
150
                false,
151
                null,
152
                null,
153
            ],
154
            $queueBag->getExchangeDeclare()
155
        );
156
    }
157
}
158