Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeprecatedConfigTest.php
Go to the documentation of this file.
1 <?php
7 
9 
15 class DeprecatedConfigTest extends \PHPUnit\Framework\TestCase
16 {
20  private $objectManager;
21 
22  protected function setUp()
23  {
25  }
26 
27  public function testGetPublisher()
28  {
30  $config = $this->objectManager->create(\Magento\Framework\MessageQueue\Publisher\ConfigInterface::class);
31  $publisher = $config->getPublisher('deprecated.config.async.string.topic');
32  $this->assertEquals('deprecated.config.async.string.topic', $publisher->getTopic());
33  $this->assertEquals(false, $publisher->isDisabled());
34 
35  $connection = $publisher->getConnection();
36  $this->assertEquals('amqp', $connection->getName());
37  $this->assertEquals('magento', $connection->getExchange());
38  $this->assertEquals(false, $connection->isDisabled());
39  }
40 
41  public function testGetPublisherCustomConnection()
42  {
44  $config = $this->objectManager->create(\Magento\Framework\MessageQueue\Publisher\ConfigInterface::class);
45  $publisher = $config->getPublisher('deprecated.config.sync.bool.topic');
46  $this->assertEquals('deprecated.config.sync.bool.topic', $publisher->getTopic());
47  $this->assertEquals(false, $publisher->isDisabled());
48 
49  $connection = $publisher->getConnection();
50  $this->assertEquals('amqp', $connection->getName());
51  $this->assertEquals('customExchange', $connection->getExchange());
52  $this->assertEquals(false, $connection->isDisabled());
53  }
54 
55  public function testGetOverlapWithQueueConfig()
56  {
58  $config = $this->objectManager->create(\Magento\Framework\MessageQueue\Publisher\ConfigInterface::class);
59  $publisher = $config->getPublisher('overlapping.topic.declaration');
60  $this->assertEquals('overlapping.topic.declaration', $publisher->getTopic());
61  $this->assertEquals(false, $publisher->isDisabled());
62 
63  $connection = $publisher->getConnection();
64  $this->assertEquals('amqp', $connection->getName());
65  $this->assertEquals('magento', $connection->getExchange());
66  $this->assertEquals(false, $connection->isDisabled());
67  }
68 }
$config
Definition: fraud_order.php:17
$connection
Definition: bulk.php:13