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

BindingManagerTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
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 43
rs 10
1
<?php
2
3
namespace Ola\RabbitMqAdminToolkitBundle\Tests\Manager;
4
5
use Ola\RabbitMqAdminToolkitBundle\Manager\BindingManager;
6
7
class BindingManagerTest extends AbstractManagerTest
8
{
9
    private $bindings;
10
11
    private $bindingManager;
12
13
    public function setUp()
14
    {
15
        parent::setUp();
16
17
        $this->bindings = $this->prophesize('RabbitMq\ManagementApi\Api\Binding');
18
        $this->client->bindings()->willReturn($this->bindings->reveal());
19
20
        $this->bindingManager = new BindingManager();
21
    }
22
23
    public function test_define_create()
24
    {
25
        $bindings = array(
26
            array('exchange' => 'bar', 'routing_key' => 'foo.#')
27
        );
28
29
        $exception = $this->get404Exception();
30
        $this->bindings->get('vhost', 'bar', 'foo', 'foo.#')->willThrow($exception->reveal());
31
32
        $this->bindings->create('vhost', 'bar', 'foo', 'foo.#')->shouldBeCalled();
33
34
        $this->bindingManager->define($this->configuration->reveal(), 'foo', $bindings);
35
    }
36
37
    public function test_define_bindingExists()
38
    {
39
        $bindings = array(
40
            array('exchange' => 'bar', 'routing_key' => 'foo.#')
41
        );
42
43
        $this->bindings->get('vhost', 'bar', 'foo', 'foo.#')->willReturn(array());
44
45
        $this->bindings->create('vhost', 'bar', 'foo', 'foo.#')->shouldNotBeCalled();
46
47
        $this->bindingManager->define($this->configuration->reveal(), 'foo', $bindings);
48
    }
49
}
50