Completed
Push — master ( be1f89...dd7c75 )
by Artem
13:35
created

ProducerTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 3
c 1
b 1
f 0
lcom 1
cbo 2
dl 0
loc 43
rs 10
1
<?php
2
3
namespace RabbitMqModule\Options;
4
5
/**
6
 * Class ProducerTest
7
 * @package RabbitMqModule\Options
8
 */
9
class ProducerTest extends \PHPUnit_Framework_TestCase
10
{
11
    public function testOptions()
12
    {
13
        $configuration = [
14
            'connection' => 'connection-name',
15
            'exchange' => [
16
                'name' => 'exchange-name',
17
            ],
18
            'queue' => [
19
                'name' => 'queue-name',
20
            ],
21
            'class' => 'class-name',
22
            'auto_setup_fabric_enabled' => false,
23
        ];
24
        $options = new Producer();
25
        $options->setFromArray($configuration);
26
27
        static::assertEquals($configuration['connection'], $options->getConnection());
28
        static::assertInstanceOf('RabbitMqModule\\Options\\Exchange', $options->getExchange());
29
        static::assertInstanceOf('RabbitMqModule\\Options\\Queue', $options->getQueue());
30
        static::assertEquals($configuration['class'], $options->getClass());
31
        static::assertFalse($options->isAutoSetupFabricEnabled());
32
    }
33
34
    /**
35
     * @expectedException \InvalidArgumentException
36
     */
37
    public function testSetQueueInvalidValue()
38
    {
39
        $options = new Producer();
40
        $options->setQueue('');
41
    }
42
43
    /**
44
     * @expectedException \InvalidArgumentException
45
     */
46
    public function testSetExchangeInvalidValue()
47
    {
48
        $options = new Producer();
49
        $options->setExchange('');
50
    }
51
}
52