20 private $objectManager;
27 public function testGetTopology()
30 $config = $this->objectManager->create(\
Magento\Framework\MessageQueue\Topology\ConfigInterface::class);
31 $topology =
$config->getExchange(
'deprecatedExchange',
'db');
32 $this->assertEquals(
'deprecatedExchange', $topology->getName());
33 $this->assertEquals(
'topic', $topology->getType());
34 $this->assertEquals(
'db', $topology->getConnection());
35 $this->assertEquals(
true, $topology->isDurable());
36 $this->assertEquals(
false, $topology->isAutoDelete());
37 $this->assertEquals(
false, $topology->isInternal());
40 $this->assertInternalType(
'array',
$arguments);
44 $bindings = $topology->getBindings();
45 $this->assertInstanceOf(BindingIterator::class, $bindings);
46 $this->assertCount(1, $bindings);
48 $bindingId =
'queue--deprecated.config.queue.2--deprecated.config.async.bool.topic';
49 $this->assertArrayHasKey($bindingId, $bindings);
50 $binding = $bindings[$bindingId];
52 $this->assertEquals(
'queue', $binding->getDestinationType());
53 $this->assertEquals(
'deprecated.config.queue.2', $binding->getDestination());
54 $this->assertEquals(
false, $binding->isDisabled());
55 $this->assertEquals(
'deprecated.config.async.bool.topic', $binding->getTopic());
57 $this->assertInternalType(
'array',
$arguments);
61 public function testGetTopologyOverlapWithQueueConfig()
64 $config = $this->objectManager->create(\
Magento\Framework\MessageQueue\Topology\ConfigInterface::class);
65 $topology =
$config->getExchange(
'overlappingDeprecatedExchange',
'amqp');
66 $this->assertEquals(
'overlappingDeprecatedExchange', $topology->getName());
67 $this->assertEquals(
'topic', $topology->getType());
68 $this->assertEquals(
'amqp', $topology->getConnection());
69 $this->assertEquals(
true, $topology->isDurable());
70 $this->assertEquals(
false, $topology->isAutoDelete());
71 $this->assertEquals(
false, $topology->isInternal());
74 $this->assertInternalType(
'array',
$arguments);
78 $bindings = $topology->getBindings();
79 $this->assertInstanceOf(BindingIterator::class, $bindings);
80 $this->assertCount(3, $bindings);
84 $bindingId =
'queue--consumer.config.queue--overlapping.topic.declaration';
85 $this->assertArrayHasKey($bindingId, $bindings);
86 $binding = $bindings[$bindingId];
87 $this->assertEquals(
'queue', $binding->getDestinationType());
88 $this->assertEquals(
'consumer.config.queue', $binding->getDestination());
89 $this->assertEquals(
false, $binding->isDisabled());
90 $this->assertEquals(
'overlapping.topic.declaration', $binding->getTopic());
92 $this->assertInternalType(
'array',
$arguments);
95 $bindingId =
'binding1';
96 $this->assertArrayHasKey($bindingId, $bindings);
97 $binding = $bindings[$bindingId];
98 $this->assertEquals(
'queue', $binding->getDestinationType());
99 $this->assertEquals(
'topology.config.queue', $binding->getDestination());
100 $this->assertEquals(
false, $binding->isDisabled());
101 $this->assertEquals(
'overlapping.topic.declaration', $binding->getTopic());
103 $this->assertInternalType(
'array',
$arguments);
106 $bindingId =
'binding2';
107 $this->assertArrayHasKey($bindingId, $bindings);
108 $binding = $bindings[$bindingId];
109 $this->assertEquals(
'queue', $binding->getDestinationType());
110 $this->assertEquals(
'topology.config.queue', $binding->getDestination());
111 $this->assertEquals(
false, $binding->isDisabled());
112 $this->assertEquals(
'deprecated.config.async.string.topic', $binding->getTopic());
114 $this->assertInternalType(
'array',
$arguments);
static getObjectManager()