Completed
Pull Request — master (#1)
by Daniel
12:19
created

getAMQPStreamConnectionMock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Cmobi\RabbitmqBundle\Tests\Connection;
4
5
use Cmobi\RabbitmqBundle\Connection\CmobiAMQPConnection;
6
use Cmobi\RabbitmqBundle\Connection\CmobiAMQPConnectionInterface;
7
use Cmobi\RabbitmqBundle\Connection\ConnectionFactory;
8
use Cmobi\RabbitmqBundle\Tests\BaseTestCase;
9
use PhpAmqpLib\Connection\AMQPStreamConnection;
10
11
12
class ConnectionFactoryTest extends BaseTestCase
13
{
14
    public function testAMQPConnectionParameter()
15
    {
16
        $class = $this->getContainer()->getParameter('cmobi_rabbitmq.connection.class');
17
18
        $this->assertTrue(is_a($class, CmobiAMQPConnectionInterface::class, true));
19
    }
20
21
    public function testAMQPConnectionFactory()
22
    {
23
        $factory = new ConnectionFactory($this->getAMQPStreamConnectionMock(), []);
24
        $connection = $factory->createConnection();
25
26
        $this->assertInstanceOf(CmobiAMQPConnectionInterface::class, $connection);
27
    }
28
29
    protected function getAMQPStreamConnectionMock()
30
    {
31
        $class = $this->getMockBuilder(CmobiAMQPConnection::class)
32
            ->disableOriginalConstructor()
33
            ->getMock();
34
35
        return $class;
36
    }
37
}