|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Noitran\Lumen\Horizon\Tests; |
|
4
|
|
|
|
|
5
|
|
|
use Interop\Amqp\AmqpTopic; |
|
6
|
|
|
use Interop\Amqp\AmqpQueue; |
|
7
|
|
|
use Interop\Amqp\AmqpProducer; |
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
class RabbitMQQueueTest extends TestCase |
|
11
|
|
|
{ |
|
12
|
|
|
public function testShouldSendExpectedMessageOnPushRaw() |
|
13
|
|
|
{ |
|
14
|
|
|
$expectedQueueName = 'theQueueName'; |
|
15
|
|
|
$expectedBody = 'thePayload'; |
|
16
|
|
|
$topic = $this->createMock(AmqpTopic::class); |
|
17
|
|
|
$queue = $this->createMock(AmqpQueue::class); |
|
18
|
|
|
$queue->expects($this->any())->method('getQueueName')->willReturn('theQueueName'); |
|
19
|
|
|
$producer = $this->createMock(AmqpProducer::class); |
|
20
|
|
|
$producer |
|
21
|
|
|
->expects($this->once()) |
|
22
|
|
|
->method('send') |
|
23
|
|
|
->with($this->identicalTo($topic), $this->isInstanceOf(AmqpMessage::class)) |
|
|
|
|
|
|
24
|
|
|
->willReturnCallback(function ($actualTopic, AmqpMessage $message) use ($expectedQueueName, $expectedBody, $topic) { |
|
25
|
|
|
$this->assertSame($topic, $actualTopic); |
|
26
|
|
|
$this->assertSame($expectedBody, $message->getBody()); |
|
27
|
|
|
$this->assertSame($expectedQueueName, $message->getRoutingKey()); |
|
28
|
|
|
$this->assertSame('application/json', $message->getContentType()); |
|
29
|
|
|
$this->assertSame(AmqpMessage::DELIVERY_MODE_PERSISTENT, $message->getDeliveryMode()); |
|
30
|
|
|
$this->assertNotEmpty($message->getCorrelationId()); |
|
31
|
|
|
$this->assertNull($message->getProperty(RabbitMQJob::ATTEMPT_COUNT_HEADERS_KEY)); |
|
|
|
|
|
|
32
|
|
|
}); |
|
33
|
|
|
$producer |
|
34
|
|
|
->expects($this->never()) |
|
35
|
|
|
->method('setDeliveryDelay'); |
|
36
|
|
|
$context = $this->createAmqpContext(); |
|
|
|
|
|
|
37
|
|
|
$context |
|
38
|
|
|
->expects($this->once()) |
|
39
|
|
|
->method('createTopic') |
|
40
|
|
|
->willReturn($topic); |
|
41
|
|
|
$context |
|
42
|
|
|
->expects($this->once()) |
|
43
|
|
|
->method('createMessage') |
|
44
|
|
|
->with($expectedBody) |
|
45
|
|
|
->willReturn(new \Interop\Amqp\Impl\AmqpMessage($expectedBody)); |
|
46
|
|
|
$context |
|
47
|
|
|
->expects($this->once()) |
|
48
|
|
|
->method('createQueue') |
|
49
|
|
|
->with($expectedQueueName) |
|
50
|
|
|
->willReturn($queue); |
|
51
|
|
|
$context |
|
52
|
|
|
->expects($this->once()) |
|
53
|
|
|
->method('createProducer') |
|
54
|
|
|
->willReturn($producer); |
|
55
|
|
|
$queue = new RabbitMQQueue($context, $this->createDummyConfig()); |
|
|
|
|
|
|
56
|
|
|
$queue->setContainer($this->createDummyContainer()); |
|
|
|
|
|
|
57
|
|
|
$queue->pushRaw('thePayload', $expectedQueueName); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths