Skip to content

Commit 1f9a42a

Browse files
committed
B2B-2155: Use Redis as message queue
- fix unit tests
1 parent 7cca53e commit 1f9a42a

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

lib/internal/Magento/Framework/MessageQueue/Test/Unit/Config/Reader/Xml/Converter/TopicConverterTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Framework\Communication\ConfigInterface;
1111
use Magento\Framework\MessageQueue\Config\Reader\Xml\Converter\TopicConfig;
1212
use Magento\Framework\MessageQueue\Config\Validator;
13+
use Magento\Framework\MessageQueue\DefaultValueProvider;
1314
use Magento\Framework\Reflection\MethodsMap;
1415
use PHPUnit\Framework\MockObject\MockObject;
1516
use PHPUnit\Framework\TestCase;
@@ -38,6 +39,11 @@ class TopicConverterTest extends TestCase
3839
*/
3940
protected $communicationConfigMock;
4041

42+
/**
43+
* @var DefaultValueProvider|MockObject
44+
*/
45+
private $defaultValueProviderMock;
46+
4147
/**
4248
* Initialize parameters
4349
*/
@@ -59,11 +65,12 @@ protected function setUp(): void
5965
$this->communicationConfigMock->expects($this->once())->method('getTopics')->willReturn($topicsDefinitions);
6066

6167
$this->communicationConfigMock->expects($this->any())->method('getTopic')->willReturnMap($topicsMap);
62-
68+
$this->defaultValueProviderMock = $this->createMock(DefaultValueProvider::class);
6369
$this->converter = new TopicConfig(
6470
$this->methodMapMock,
6571
$this->validatorMock,
66-
$this->communicationConfigMock
72+
$this->communicationConfigMock,
73+
$this->defaultValueProviderMock
6774
);
6875
}
6976

lib/internal/Magento/Framework/MessageQueue/Test/Unit/DefaultValueProviderTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ protected function setUp(): void
3939
*/
4040
public function testGetConnection(): void
4141
{
42+
$this->config->method('get')->willReturnMap(
43+
[
44+
['queue', null, ['key' => 'test_connection']],
45+
]
46+
);
4247
$this->assertEquals('db', $this->model->getConnection());
4348
}
4449

@@ -66,7 +71,8 @@ public function testGetAMQPConnection(): void
6671
$this->config->method('get')->willReturnMap(
6772
[
6873
['queue/default_connection', null, null],
69-
['queue/amqp', null, ['host' => '127.0.0.1', 'port' => '5672']]
74+
['queue/amqp', null, ['host' => '127.0.0.1', 'port' => '5672']],
75+
['queue', null, ['amqp' => ['host' => '127.0.0.1', 'port' => '5672']]]
7076
]
7177
);
7278

0 commit comments

Comments
 (0)