AfterProcessingMessageEventTest::getConsumer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
namespace OldSound\RabbitMqBundle\Tests\Event;
4
5
use OldSound\RabbitMqBundle\Event\AfterProcessingMessageEvent;
6
use OldSound\RabbitMqBundle\RabbitMq\Consumer;
7
use PhpAmqpLib\Message\AMQPMessage;
8
use PHPUnit\Framework\TestCase;
9
10
/**
11
 * Class AfterProcessingMessageEventTest
12
 *
13
 * @package OldSound\RabbitMqBundle\Tests\Event
14
 */
15
class AfterProcessingMessageEventTest extends TestCase
16
{
17
    protected function getConsumer()
18
    {
19
        return new Consumer(
20
            $this->getMockBuilder('\PhpAmqpLib\Connection\AMQPStreamConnection')
21
                ->disableOriginalConstructor()
22
                ->getMock(),
23
            $this->getMockBuilder('\PhpAmqpLib\Channel\AMQPChannel')
24
                ->disableOriginalConstructor()
25
                ->getMock()
26
        );
27
    }
28
29
    public function testEvent()
30
    {
31
        $AMQPMessage = new AMQPMessage('body');
32
        $consumer = $this->getConsumer();
33
        $event = new AfterProcessingMessageEvent($consumer, $AMQPMessage);
34
        $this->assertSame($AMQPMessage, $event->getAMQPMessage());
35
        $this->assertSame($consumer, $event->getConsumer());
36
    }
37
}
38