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

RpcClientTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 4
c 1
b 1
f 0
lcom 0
cbo 2
dl 0
loc 44
rs 10
1
<?php
2
3
namespace RabbitMqModule\Options;
4
5
/**
6
 * Class RpcClientTest
7
 * @package RabbitMqModule\Options
8
 */
9
class RpcClientTest extends \PHPUnit_Framework_TestCase
10
{
11
    public function testSetConnection()
12
    {
13
        $options = new RpcClient();
14
        $options->setConnection('connection-name');
15
16
        static::assertEquals('connection-name', $options->getConnection());
17
    }
18
19
    public function testSetSerializer()
20
    {
21
        $options = new RpcClient();
22
23
        $options->setSerializer('PhpSerialize');
24
        static::assertInstanceOf('Zend\\Serializer\\Adapter\\AdapterInterface', $options->getSerializer());
25
26
        $options->setSerializer(null);
27
        static::assertNull($options->getSerializer());
28
29
        $options->setSerializer(['name' => 'PhpSerialize']);
30
        static::assertInstanceOf('Zend\\Serializer\\Adapter\\AdapterInterface', $options->getSerializer());
31
    }
32
33
    /**
34
     * @expectedException \InvalidArgumentException
35
     */
36
    public function testSetSerializerWithInvalidValue()
37
    {
38
        $options = new RpcClient();
39
40
        $options->setSerializer(true);
41
    }
42
43
    /**
44
     * @expectedException \InvalidArgumentException
45
     */
46
    public function testSetSerializerWithEmptyArray()
47
    {
48
        $options = new RpcClient();
49
50
        $options->setSerializer([]);
51
    }
52
}
53