Completed
Push — master ( 7130b4...072877 )
by
unknown
93:03 queued 53:10
created

MongoDriverTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testDriver() 0 17 1
1
<?php
2
3
namespace SfCod\QueueBundle\Tests\Service;
4
5
use MongoDB\Client;
6
use MongoDB\Database;
7
use PHPUnit\Framework\TestCase;
8
use SfCod\QueueBundle\Service\MongoDriver;
9
10
/**
11
 * Class MongoDriverTest
12
 *
13
 * @author Virchenko Maksim <[email protected]>
14
 *
15
 * @package SfCod\QueueBundle\Tests\Service
16
 */
17
class MongoDriverTest extends TestCase
18
{
19
    /**
20
     * Test mongo driver
21
     */
22
    public function testDriver()
23
    {
24
        $uri = uniqid('mongodb://');
25
        $uriOptions = range(1, 10);
26
        $driverOptions = range(11, 21);
27
        $dbName = uniqid('db_');
28
29
        $driver = new MongoDriver();
30
        $driver->setCredentials($uri, $uriOptions, $driverOptions);
31
32
        $this->assertInstanceOf(Client::class, $driver->getClient());
33
34
        $driver->setDbname($dbName);
35
36
        $this->assertInstanceOf(Database::class, $driver->getDatabase());
37
        $this->assertEquals($dbName, $driver->getDatabase()->getDatabaseName());
38
    }
39
}
40