Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
All Data Structures Namespaces Files Functions Variables Pages
ExchangeInstallerTest.php
Go to the documentation of this file.
1 <?php
7 
11 use PhpAmqpLib\Channel\AMQPChannel;
13 
14 class ExchangeInstallerTest extends \PHPUnit\Framework\TestCase
15 {
16  public function testInstall()
17  {
18  $bindingInstaller = $this->createMock(BindingInstallerInterface::class);
19  $model = new ExchangeInstaller($bindingInstaller);
20  $channel = $this->createMock(AMQPChannel::class);
21 
22  $binding = $this->createMock(BindingInterface::class);
23 
24  $exchange = $this->createMock(ExchangeConfigItemInterface::class);
25  $exchange->expects($this->exactly(2))->method('getName')->willReturn('magento');
26  $exchange->expects($this->once())->method('getType')->willReturn('topic');
27  $exchange->expects($this->once())->method('isDurable')->willReturn(true);
28  $exchange->expects($this->once())->method('isAutoDelete')->willReturn(false);
29  $exchange->expects($this->once())->method('isInternal')->willReturn(false);
30  $exchange->expects($this->once())->method('getArguments')->willReturn(['some' => 'value']);
31  $exchange->expects($this->once())->method('getBindings')->willReturn(['bind01' => $binding]);
32 
33  $channel->expects($this->once())
34  ->method('exchange_declare')
35  ->with('magento', 'topic', false, true, false, false, false, ['some' => ['S', 'value']], null);
36  $bindingInstaller->expects($this->once())->method('install')->with($channel, $binding, 'magento');
37  $model->install($channel, $exchange);
38  }
39 }