MessageTest::testGetExchangeName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace AMQPAL\Adapter;
4
5
class MessageTest extends \PHPUnit_Framework_TestCase
6
{
7
    /**
8
     * @var Message;
9
     */
10
    protected $message;
11
12
    protected function setUp()
13
    {
14
        parent::setUp();
15
16
        $this->message = new Message();
17
    }
18
19
    public function testGetBody()
20
    {
21
        static::assertNull($this->message->getBody());
22
        $this->message->setBody('foo');
23
        static::assertEquals('foo', $this->message->getBody());
24
    }
25
26
    public function testGetRoutingKey()
27
    {
28
        static::assertNull($this->message->getRoutingKey());
29
        $this->message->setRoutingKey('foo');
30
        static::assertEquals('foo', $this->message->getRoutingKey());
31
    }
32
33
    public function testGetDeliveryTag()
34
    {
35
        static::assertNull($this->message->getDeliveryTag());
36
        $this->message->setDeliveryTag('foo');
37
        static::assertEquals('foo', $this->message->getDeliveryTag());
38
    }
39
40
    public function testGetDeliveryMode()
41
    {
42
        static::assertNull($this->message->getDeliveryMode());
43
        $this->message->setDeliveryMode(2);
44
        static::assertEquals(2, $this->message->getDeliveryMode());
45
    }
46
47
    public function testGetExchangeName()
48
    {
49
        static::assertNull($this->message->getExchangeName());
50
        $this->message->setExchangeName('foo');
51
        static::assertEquals('foo', $this->message->getExchangeName());
52
    }
53
54
    public function testIsRedelivered()
55
    {
56
        static::assertFalse($this->message->isRedelivered());
57
        $this->message->setRedelivered(true);
58
        static::assertEquals(true, $this->message->isRedelivered());
59
    }
60
61
    public function testGetContentType()
62
    {
63
        static::assertNull($this->message->getContentType());
64
        $this->message->setContentType('foo');
65
        static::assertEquals('foo', $this->message->getContentType());
66
    }
67
68
    public function testGetContentEncoding()
69
    {
70
        static::assertNull($this->message->getContentEncoding());
71
        $this->message->setContentEncoding('foo');
72
        static::assertEquals('foo', $this->message->getContentEncoding());
73
    }
74
75
    public function testGetType()
76
    {
77
        static::assertNull($this->message->getType());
78
        $this->message->setType('foo');
79
        static::assertEquals('foo', $this->message->getType());
80
    }
81
82
    public function testGetDateTime()
83
    {
84
        static::assertNull($this->message->getDateTime());
85
        $dateTime = new \DateTime();
86
        $this->message->setDateTime($dateTime);
87
        static::assertSame($dateTime, $this->message->getDateTime());
88
    }
89
90
    public function testGetPriority()
91
    {
92
        static::assertNull($this->message->getPriority());
93
        $this->message->setPriority(5);
94
        static::assertEquals(5, $this->message->getPriority());
95
    }
96
97
    public function testGetExpiration()
98
    {
99
        static::assertNull($this->message->getExpiration());
100
        $dateTime = new \DateTime();
101
        $this->message->setExpiration($dateTime);
102
        static::assertSame($dateTime, $this->message->getExpiration());
103
    }
104
105
    public function testGetUserId()
106
    {
107
        static::assertNull($this->message->getUserId());
108
        $this->message->setUserId('foo');
109
        static::assertEquals('foo', $this->message->getUserId());
110
    }
111
112
    public function testGetAppId()
113
    {
114
        static::assertNull($this->message->getAppId());
115
        $this->message->setAppId('foo');
116
        static::assertEquals('foo', $this->message->getAppId());
117
    }
118
119
    public function testGetMessageId()
120
    {
121
        static::assertNull($this->message->getMessageId());
122
        $this->message->setMessageId('foo');
123
        static::assertEquals('foo', $this->message->getMessageId());
124
    }
125
126
    public function testGetReplyTo()
127
    {
128
        static::assertNull($this->message->getReplyTo());
129
        $this->message->setReplyTo('foo');
130
        static::assertEquals('foo', $this->message->getReplyTo());
131
    }
132
133
    public function testGetCorrelationId()
134
    {
135
        static::assertNull($this->message->getCorrelationId());
136
        $this->message->setCorrelationId('foo');
137
        static::assertEquals('foo', $this->message->getCorrelationId());
138
    }
139
140
    public function testGetHeaders()
141
    {
142
        static::assertEquals([], $this->message->getHeaders());
143
        $this->message->setHeaders(['foo' => 'bar']);
144
        static::assertEquals(['foo' => 'bar'], $this->message->getHeaders());
145
    }
146
}
147