|
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') |
|
|
|
|
|
|
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); |
|
|
|
|
|
|
51
|
|
|
$this->consumer->forceStopConsumer(); |
|
52
|
|
|
$this->assertAttributeEquals(true, 'forceStop', $this->consumer); |
|
|
|
|
|
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|
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..