Skip to content

Commit 77481df

Browse files
committed
fix queue attribute
1 parent 6dc2d25 commit 77481df

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/Queue/Jobs/RabbitMQJob.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public function __construct(
3636
$this->connection = $connection;
3737
$this->consumer = $consumer;
3838
$this->message = $message;
39+
$this->queue = $consumer->getQueue()->getQueueName();
3940
}
4041

4142
/**

tests/Queue/Jobs/RabbitMQJobTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Illuminate\Queue\Jobs\Job;
99
use Interop\Amqp\AmqpConsumer;
1010
use Interop\Amqp\Impl\AmqpMessage;
11+
use Interop\Amqp\Impl\AmqpQueue;
1112
use PHPUnit\Framework\TestCase;
1213
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Jobs\RabbitMQJob;
1314
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue;
@@ -48,9 +49,18 @@ public function testCouldBeConstructedWithExpectedArguments()
4849
/**
4950
* @return AmqpConsumer|\PHPUnit_Framework_MockObject_MockObject|AmqpConsumer
5051
*/
51-
private function createConsumerMock()
52+
private function createConsumerMock(string $queueName = 'test')
5253
{
53-
return $this->createMock(AmqpConsumer::class);
54+
$mock = $this->createMock(AmqpConsumer::class);
55+
56+
if (!$queueName !== '')
57+
{
58+
$mock->expects($this->once())
59+
->method('getQueue')
60+
->willReturn(new AmqpQueue($queueName));
61+
}
62+
63+
return $mock;
5464
}
5565

5666
/**

0 commit comments

Comments
 (0)