Skip to content

Commit 00a03e9

Browse files
author
Bartosz Kubicki
committed
Fixes after CR
1 parent 5ee0054 commit 00a03e9

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

lib/internal/Magento/Framework/MessageQueue/Test/Unit/Topology/Config/QueueConfigItem/DataMapperTest.php

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* Copyright © Magento, Inc. All rights reserved.
77
* See COPYING.txt for license details.
88
*/
9-
declare(strict_types=1);
109

1110
namespace Magento\Framework\MessageQueue\Test\Unit\Topology\Config\QueueConfigItem;
1211

@@ -23,17 +22,17 @@ class DataMapperTest extends TestCase
2322
/**
2423
* @var Data|MockObject
2524
*/
26-
private $configData;
25+
private $configDataMock;
2726

2827
/**
2928
* @var CommunicationConfig|MockObject
3029
*/
31-
private $communicationConfig;
30+
private $communicationConfigMock;
3231

3332
/**
3433
* @var ResponseQueueNameBuilder|MockObject
3534
*/
36-
private $queueNameBuilder;
35+
private $queueNameBuilderMock;
3736

3837
/**
3938
* @var DataMapper
@@ -45,10 +44,14 @@ class DataMapperTest extends TestCase
4544
*/
4645
protected function setUp(): void
4746
{
48-
$this->configData = $this->createMock(Data::class);
49-
$this->communicationConfig = $this->createMock(CommunicationConfig::class);
50-
$this->queueNameBuilder = $this->createMock(ResponseQueueNameBuilder::class);
51-
$this->model = new DataMapper($this->configData, $this->communicationConfig, $this->queueNameBuilder);
47+
$this->configDataMock = $this->createMock(Data::class);
48+
$this->communicationConfigMock = $this->createMock(CommunicationConfig::class);
49+
$this->queueNameBuilderMock = $this->createMock(ResponseQueueNameBuilder::class);
50+
$this->model = new DataMapper(
51+
$this->configDataMock,
52+
$this->communicationConfigMock,
53+
$this->queueNameBuilderMock
54+
);
5255
}
5356

5457
/**
@@ -112,11 +115,11 @@ public function testGetMappedData(): void
112115
['topic02', ['name' => 'topic02', 'is_synchronous' => false]],
113116
];
114117

115-
$this->communicationConfig->expects($this->exactly(2))
118+
$this->communicationConfigMock->expects($this->exactly(2))
116119
->method('getTopic')
117120
->willReturnMap($communicationMap);
118-
$this->configData->expects($this->once())->method('get')->willReturn($data);
119-
$this->queueNameBuilder->expects($this->once())
121+
$this->configDataMock->expects($this->once())->method('get')->willReturn($data);
122+
$this->queueNameBuilderMock->expects($this->once())
120123
->method('getQueueName')
121124
->with('topic01')
122125
->willReturn('responseQueue.topic01');
@@ -218,15 +221,15 @@ public function testGetMappedDataForWildcard(): void
218221
'topic08.part2.some.test' => ['name' => 'topic08.part2.some.test', 'is_synchronous' => true],
219222
];
220223

221-
$this->communicationConfig->expects($this->once())
224+
$this->communicationConfigMock->expects($this->once())
222225
->method('getTopic')
223226
->with('topic01')
224227
->willReturn(['name' => 'topic01', 'is_synchronous' => true]);
225-
$this->communicationConfig->expects($this->any())
228+
$this->communicationConfigMock->expects($this->any())
226229
->method('getTopics')
227230
->willReturn($communicationData);
228-
$this->configData->expects($this->once())->method('get')->willReturn($data);
229-
$this->queueNameBuilder->expects($this->any())
231+
$this->configDataMock->expects($this->once())->method('get')->willReturn($data);
232+
$this->queueNameBuilderMock->expects($this->any())
230233
->method('getQueueName')
231234
->willReturnCallback(function ($value) {
232235
return 'responseQueue.' . $value;

lib/internal/Magento/Framework/MessageQueue/Topology/Config/QueueConfigItem/DataMapper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ public function getMappedData(): array
7373
foreach ($exchange['bindings'] as $binding) {
7474
if ($binding['destinationType'] === 'queue') {
7575
$queueItems = $this->createQueueItems(
76-
(string) $binding['destination'],
77-
(string) $binding['topic'],
78-
(array) $binding['arguments'],
79-
(string) $connection
76+
(string)$binding['destination'],
77+
(string)$binding['topic'],
78+
(array)$binding['arguments'],
79+
(string)$connection
8080
);
81-
$this->mappedData += $queueItems;
81+
$this->mappedData = array_merge($this->mappedData, $queueItems);
8282
}
8383
}
8484
}
@@ -141,7 +141,7 @@ private function isSynchronousTopic(string $topicName): bool
141141
{
142142
try {
143143
$topic = $this->communicationConfig->getTopic($topicName);
144-
return (bool) $topic[CommunicationConfig::TOPIC_IS_SYNCHRONOUS];
144+
return (bool)$topic[CommunicationConfig::TOPIC_IS_SYNCHRONOUS];
145145
} catch (LocalizedException $exception) {
146146
throw new LocalizedException(new Phrase('Error while checking if topic is synchronous'));
147147
}

0 commit comments

Comments
 (0)