Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BindingInstallerTest.php
Go to the documentation of this file.
1 <?php
7 
10 use PhpAmqpLib\Channel\AMQPChannel;
12 
13 class BindingInstallerTest extends \PHPUnit\Framework\TestCase
14 {
15  public function testInstall()
16  {
17  $installerOne = $this->createMock(BindingInstallerInterface::class);
18  $installerTwo = $this->createMock(BindingInstallerInterface::class);
20  [
21  'queue' => $installerOne,
22  'exchange' => $installerTwo,
23  ]
24  );
25  $channel = $this->createMock(AMQPChannel::class);
26  $binding = $this->createMock(BindingInterface::class);
27  $binding->expects($this->once())->method('getDestinationType')->willReturn('queue');
28  $installerOne->expects($this->once())->method('install')->with($channel, $binding, 'magento');
29  $installerTwo->expects($this->never())->method('install');
30  $model->install($channel, $binding, 'magento');
31  }
32 
37  public function testInstallInvalidType()
38  {
39  $installerOne = $this->createMock(BindingInstallerInterface::class);
40  $installerTwo = $this->createMock(BindingInstallerInterface::class);
42  [
43  'queue' => $installerOne,
44  'exchange' => $installerTwo,
45  ]
46  );
47  $channel = $this->createMock(AMQPChannel::class);
48  $binding = $this->createMock(BindingInterface::class);
49  $binding->expects($this->once())->method('getDestinationType')->willReturn('test');
50  $installerOne->expects($this->never())->method('install');
51  $installerTwo->expects($this->never())->method('install');
52  $model->install($channel, $binding, 'magento');
53  }
54 }