Passed
Branch master (ae31ea)
by Timon
04:39 queued 01:38
created

ConnectionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 2
cbo 4
dl 0
loc 36
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testConnect() 0 7 1
A testServer() 0 7 1
1
<?php
2
declare(strict_types=1);
3
4
namespace TBolier\RethinkQL\IntegrationTest\Connection;
5
6
use Mockery;
7
use Mockery\MockInterface;
8
use TBolier\RethinkQL\Connection\ConnectionInterface;
9
use TBolier\RethinkQL\Connection\OptionsInterface;
10
use TBolier\RethinkQL\IntegrationTest\BaseTestCase;
11
use TBolier\RethinkQL\Types\Query\QueryType;
12
13
class ConnectionTest extends BaseTestCase
14
{
15
    /**
16
     * @var MockInterface
17
     */
18
    private $optionsMock;
19
20
    public function setUp()
21
    {
22
        parent::setUp();
23
24
        $this->optionsMock = Mockery::mock(OptionsInterface::class);
25
    }
26
27
    /**
28
     * @throws \Exception
29
     */
30
    public function testConnect()
31
    {
32
        /** @var ConnectionInterface $connection */
33
        $connection = $this->createConnection('phpunit_default')->connect();
34
35
        $this->assertInternalType('array', $connection->expr('foo'));
36
    }
37
38
    /**
39
     * @throws \Exception
40
     */
41
    public function testServer()
42
    {
43
        /** @var ConnectionInterface $connection */
44
        $res = $this->createConnection('phpunit_default')->connect()->server();
45
46
        $this->assertEquals(QueryType::SERVER_INFO, $res['t']);
47
    }
48
}
49