Skip to content

Commit 6ba9bd1

Browse files
authored
Merge pull request vyuldashev#164 from net53/master
add connection name to Job
2 parents c8f2552 + 02a5e87 commit 6ba9bd1

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Queue/Jobs/RabbitMQJob.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function __construct(
3737
$this->consumer = $consumer;
3838
$this->message = $message;
3939
$this->queue = $consumer->getQueue()->getQueueName();
40+
$this->connectionName = $connection->getConnectionName();
4041
}
4142

4243
/**

tests/Queue/Jobs/RabbitMQJobTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,22 @@ public function testCouldBeConstructedWithExpectedArguments()
5252
->willReturn($queue)
5353
;
5454

55+
$connectionMock = $this->createRabbitMQQueueMock();
56+
$connectionMock
57+
->expects($this->any())
58+
->method('getConnectionName')
59+
->willReturn('theConnectionName')
60+
;
61+
5562
$job = new RabbitMQJob(
5663
new Container(),
57-
$this->createRabbitMQQueueMock(),
64+
$connectionMock,
5865
$consumerMock,
5966
new AmqpMessage()
6067
);
6168

6269
$this->assertAttributeSame('theQueueName', 'queue', $job);
70+
$this->assertSame('theConnectionName', $job->getConnectionName());
6371
}
6472

6573
/**

0 commit comments

Comments
 (0)