BeforeProcessingMessageEventTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 13
c 1
b 0
f 1
dl 0
loc 21
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testEvent() 0 7 1
A getConsumer() 0 9 1
1
<?php
2
3
namespace OldSound\RabbitMqBundle\Tests\Event;
4
5
use OldSound\RabbitMqBundle\Event\BeforeProcessingMessageEvent;
6
use OldSound\RabbitMqBundle\RabbitMq\Consumer;
7
use PhpAmqpLib\Message\AMQPMessage;
8
use PHPUnit\Framework\TestCase;
9
10
/**
11
 * Class BeforeProcessingMessageEventTest
12
 *
13
 * @package OldSound\RabbitMqBundle\Tests\Event
14
 */
15
class BeforeProcessingMessageEventTest 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 BeforeProcessingMessageEvent($consumer, $AMQPMessage);
34
        $this->assertSame($AMQPMessage, $event->getAMQPMessage());
35
        $this->assertSame($consumer, $event->getConsumer());
36
    }
37
}
38