1 | <?php |
||
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 |