BaseConsumerTest   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 45
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testItsIdleTimeoutIsMutable() 0 5 1
A testForceStopConsumer() 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(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
    public function testForceStopConsumer()
49
    {
50
        $this->assertAttributeEquals(false, 'forceStop', $this->consumer);
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\Assert::assertAttributeEquals() has been deprecated: https://github.com/sebastianbergmann/phpunit/issues/3338 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

50
        /** @scrutinizer ignore-deprecated */ $this->assertAttributeEquals(false, 'forceStop', $this->consumer);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
51
        $this->consumer->forceStopConsumer();
52
        $this->assertAttributeEquals(true, 'forceStop', $this->consumer);
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\Assert::assertAttributeEquals() has been deprecated: https://github.com/sebastianbergmann/phpunit/issues/3338 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

52
        /** @scrutinizer ignore-deprecated */ $this->assertAttributeEquals(true, 'forceStop', $this->consumer);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
53
    }
54
}
55