Skip to content

Commit

Permalink
Set channel name to a newly created adapter in QueueFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorprogger committed Aug 25, 2024
1 parent c076100 commit de90119
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/QueueFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private function create(string $channel): QueueInterface
if (isset($this->channelConfiguration[$channel])) {
$definition = $this->channelConfiguration[$channel];
$this->checkDefinitionType($channel, $definition);
$adapter = $this->createFromDefinition($channel, $definition);
$adapter = $this->createFromDefinition($channel, $definition)->withChannel($channel);

return $this->queue->withChannelName($channel)->withAdapter($adapter);
}
Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/QueueFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ public function testThrowExceptionOnIncorrectDefinition(): void
public function testSuccessfulDefinitionWithDefaultAdapter(): void
{
$adapterDefault = $this->createMock(AdapterInterface::class);
$adapterDefault->method('withChannel')->willReturn($adapterDefault);

$adapterNew = $this->createMock(AdapterInterface::class);
$adapterNew->method('withChannel')->willReturn($adapterNew);

$queue = $this->createMock(QueueInterface::class);
$queue
Expand Down Expand Up @@ -142,6 +145,7 @@ public function testSuccessfulDefinitionWithDefaultAdapter(): void
public function testSuccessfulDefinitionWithoutDefaultAdapter(): void
{
$adapterNew = $this->createMock(AdapterInterface::class);
$adapterNew->method('withChannel')->willReturn($adapterNew);

$queue = $this->createMock(QueueInterface::class);
$queue
Expand Down

0 comments on commit de90119

Please sign in to comment.