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

VhostConfigurationTest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 8
c 1
b 0
f 1
lcom 1
cbo 3
dl 0
loc 48
rs 10
1
<?php
2
3
namespace Ola\RabbitMqAdminToolkitBundle\Tests;
4
5
use Ola\RabbitMqAdminToolkitBundle\VhostConfiguration;
6
7
class VhostConfigurationTest extends \PHPUnit_Framework_TestCase
8
{
9
    private $client;
10
    private $configuration;
11
12
    public function setUp()
13
    {
14
        $this->createConfiguration();
15
    }
16
17
    public function test_getClient()
18
    {
19
        $this->assertSame($this->client->reveal(), $this->configuration->getClient());
20
    }
21
22
    public function test_getName()
23
    {
24
        $this->assertSame('foo', $this->configuration->getName());
25
    }
26
27
    public function test_getConfiguration_all()
28
    {
29
        $this->assertSame(array('foo' => 'bar'), $this->configuration->getConfiguration());
30
    }
31
32
    public function test_getConfiguration_singleKey()
33
    {
34
        $this->assertSame('bar', $this->configuration->getConfiguration('foo'));
35
    }
36
37
    public function test_isDeleteAllowed_global()
38
    {
39
        $this->assertSame(false, $this->configuration->isDeleteAllowed());
40
    }
41
42
    public function test_isDeleteAllowed_vhostOverride()
43
    {
44
        $this->createConfiguration(array('delete_allowed' => true));
45
        $this->assertSame(true, $this->configuration->isDeleteAllowed());
46
    }
47
48
    private function createConfiguration($configuration = array('foo' => 'bar'))
49
    {
50
        $this->client = $this->prophesize('RabbitMq\ManagementApi\Client');
51
52
        $this->configuration = new VhostConfiguration($this->client->reveal(), 'foo', $configuration, false);
53
    }
54
}
55