|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ola\RabbitMqAdminToolkitBundle\Tests; |
|
4
|
|
|
|
|
5
|
|
|
use Ola\RabbitMqAdminToolkitBundle\VhostHandler; |
|
6
|
|
|
|
|
7
|
|
|
class VhostHandlerTest extends \PHPUnit_Framework_TestCase |
|
8
|
|
|
{ |
|
9
|
|
|
private $vhostManager; |
|
10
|
|
|
private $permissionManager; |
|
11
|
|
|
private $exchangeManager; |
|
12
|
|
|
private $queueManager; |
|
13
|
|
|
|
|
14
|
|
|
private $configuration; |
|
15
|
|
|
|
|
16
|
|
|
private $vhostHandler; |
|
17
|
|
|
|
|
18
|
|
|
public function setUp() |
|
19
|
|
|
{ |
|
20
|
|
|
$this->vhostManager = $this->prophesize('Ola\RabbitMqAdminToolkitBundle\Manager\VhostManager'); |
|
21
|
|
|
$this->permissionManager = $this->prophesize('Ola\RabbitMqAdminToolkitBundle\Manager\PermissionManager'); |
|
22
|
|
|
$this->exchangeManager = $this->prophesize('Ola\RabbitMqAdminToolkitBundle\Manager\ExchangeManager'); |
|
23
|
|
|
$this->queueManager = $this->prophesize('Ola\RabbitMqAdminToolkitBundle\Manager\QueueManager'); |
|
24
|
|
|
|
|
25
|
|
|
$this->configuration = $this->prophesize('Ola\RabbitMqAdminToolkitBundle\VhostConfiguration'); |
|
26
|
|
|
|
|
27
|
|
|
$this->vhostHandler = new VhostHandler( |
|
28
|
|
|
$this->vhostManager->reveal(), |
|
29
|
|
|
$this->permissionManager->reveal(), |
|
30
|
|
|
$this->exchangeManager->reveal(), |
|
31
|
|
|
$this->queueManager->reveal() |
|
32
|
|
|
); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function test_exists() |
|
36
|
|
|
{ |
|
37
|
|
|
$this->vhostManager->exists($this->configuration->reveal())->willReturn(true); |
|
38
|
|
|
|
|
39
|
|
|
$this->assertTrue($this->vhostHandler->exists($this->configuration->reveal())); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function test_define() |
|
43
|
|
|
{ |
|
44
|
|
|
$this->vhostManager->define($this->configuration)->shouldBeCalled(); |
|
45
|
|
|
$this->permissionManager->define($this->configuration)->shouldBeCalled(); |
|
46
|
|
|
$this->exchangeManager->define($this->configuration)->shouldBeCalled(); |
|
47
|
|
|
$this->queueManager->define($this->configuration)->shouldBeCalled(); |
|
48
|
|
|
|
|
49
|
|
|
$this->vhostHandler->define($this->configuration->reveal()); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|