Passed
Push — master ( 3e304d...441efe )
by Ramūnas
09:23
created

BaseConsumerTest::testForceStopConsumer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
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(array($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