|
14 | 14 | use Magento\Framework\MessageQueue\Rpc\ResponseQueueNameBuilder;
|
15 | 15 | use Magento\Framework\MessageQueue\Topology\Config\Data;
|
16 | 16 | use Magento\Framework\MessageQueue\Topology\Config\QueueConfigItem\DataMapper;
|
| 17 | +use Magento\Framework\Phrase; |
17 | 18 | use PHPUnit\Framework\MockObject\MockObject;
|
18 | 19 | use PHPUnit\Framework\TestCase;
|
19 | 20 |
|
@@ -289,4 +290,46 @@ public function testGetMappedDataForWildcard(): void
|
289 | 290 | ];
|
290 | 291 | $this->assertEquals($expectedResult, $actualResult);
|
291 | 292 | }
|
| 293 | + |
| 294 | + /** |
| 295 | + * @return void |
| 296 | + */ |
| 297 | + public function testTopicIsSynchronousException(): void |
| 298 | + { |
| 299 | + $topicName = 'topic01'; |
| 300 | + $data = [ |
| 301 | + 'ex01' => [ |
| 302 | + 'name' => 'ex01', |
| 303 | + 'type' => 'topic', |
| 304 | + 'connection' => 'amqp', |
| 305 | + 'durable' => true, |
| 306 | + 'internal' => false, |
| 307 | + 'autoDelete' => false, |
| 308 | + 'arguments' => ['some' => 'argument'], |
| 309 | + 'bindings' => [ |
| 310 | + 'bind01' => [ |
| 311 | + 'id' => 'bind01', |
| 312 | + 'topic' => $topicName, |
| 313 | + 'destinationType' => 'queue', |
| 314 | + 'destination' => 'some.queue', |
| 315 | + 'disabled' => false, |
| 316 | + 'arguments' => ['some' => 'arguments'], |
| 317 | + ], |
| 318 | + ], |
| 319 | + ], |
| 320 | + ]; |
| 321 | + |
| 322 | + $this->communicationConfigMock->expects($this->exactly(1)) |
| 323 | + ->method('getTopic') |
| 324 | + ->willThrowException(new LocalizedException( |
| 325 | + new Phrase('Topic "%topic" is not configured.', ['topic' => $topicName]) |
| 326 | + )); |
| 327 | + |
| 328 | + $this->configDataMock->expects($this->once())->method('get')->willReturn($data); |
| 329 | + |
| 330 | + $this->expectException(LocalizedException::class); |
| 331 | + $this->expectExceptionMessage(sprintf('Error while checking if topic "%s" is synchronous', $topicName)); |
| 332 | + |
| 333 | + $this->model->getMappedData(); |
| 334 | + } |
292 | 335 | }
|
0 commit comments