Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AsyncMultipleTopicsWithEachQueueTest.php
Go to the documentation of this file.
1 <?php
7 
9 {
13  protected $uniqueID;
14 
18  protected $msgObject;
19 
23  protected $consumers = ['queue.for.multiple.topics.test.y', 'queue.for.multiple.topics.test.z'];
24 
28  private $topics = ['multi.topic.queue.topic.y', 'multi.topic.queue.topic.z'];
29 
36  {
37  $this->msgObject = $this->objectManager->create(\Magento\TestModuleAsyncAmqp\Model\AsyncTestData::class);
38 
39  foreach ($this->topics as $topic) {
40  $this->uniqueID[$topic] = md5(uniqid($topic));
41  $this->msgObject->setValue($this->uniqueID[$topic] . "_" . $topic);
42  $this->msgObject->setTextFilePath($this->logFilePath);
43  $this->publisher->publish($topic, $this->msgObject);
44  }
45 
46  $this->waitForAsynchronousResult(count($this->uniqueID), $this->logFilePath);
47 
48  //assertions
49  foreach ($this->topics as $item) {
50  $this->assertContains($this->uniqueID[$item] . "_" . $item, file_get_contents($this->logFilePath));
51  }
52  }
53 }