Completed
Push — master ( 627c37...9fcd11 )
by Olivier
03:49 queued 01:55
created

VhostHandlerTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 3
dl 0
loc 45
rs 10
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