BaseConsumerTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 38
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testItsIdleTimeoutIsMutable() 0 5 1
A testItImplementsDequeuerInterface() 0 3 1
A testItsIdleTimeoutExitCodeIsMutable() 0 5 1
A testItExtendsBaseAmqpInterface() 0 3 1
A setUp() 0 9 1
1
<?php
2
3
namespace OldSound\RabbitMqBundle\Tests\RabbitMq;
4
5
use OldSound\RabbitMqBundle\RabbitMq\BaseConsumer;
6
use PHPUnit\Framework\TestCase;
7
8
class BaseConsumerTest extends TestCase
9
{
10
    /** @var BaseConsumer */
11
    protected $consumer;
12
13
    protected function setUp(): void
14
    {
15
        $amqpConnection = $this->getMockBuilder('\PhpAmqpLib\Connection\AMQPStreamConnection')
16
            ->disableOriginalConstructor()
17
            ->getMock();
18
19
        $this->consumer = $this->getMockBuilder('\OldSound\RabbitMqBundle\RabbitMq\BaseConsumer')
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockBuilder('\...tMockForAbstractClass() of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type OldSound\RabbitMqBundle\RabbitMq\BaseConsumer of property $consumer.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
20
            ->setConstructorArgs([$amqpConnection])
21
            ->getMockForAbstractClass();
22
    }
23
24
    public function testItExtendsBaseAmqpInterface()
25
    {
26
        $this->assertInstanceOf('OldSound\RabbitMqBundle\RabbitMq\BaseAmqp', $this->consumer);
27
    }
28
29
    public function testItImplementsDequeuerInterface()
30
    {
31
        $this->assertInstanceOf('OldSound\RabbitMqBundle\RabbitMq\DequeuerInterface', $this->consumer);
32
    }
33
34
    public function testItsIdleTimeoutIsMutable()
35
    {
36
        $this->assertEquals(0, $this->consumer->getIdleTimeout());
37
        $this->consumer->setIdleTimeout(42);
38
        $this->assertEquals(42, $this->consumer->getIdleTimeout());
39
    }
40
41
    public function testItsIdleTimeoutExitCodeIsMutable()
42
    {
43
        $this->assertEquals(0, $this->consumer->getIdleTimeoutExitCode());
44
        $this->consumer->setIdleTimeoutExitCode(43);
45
        $this->assertEquals(43, $this->consumer->getIdleTimeoutExitCode());
46
    }
47
}
48