MongoDriverTest::testDriver()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 0
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
        self::assertInstanceOf(Client::class, $driver->getClient());
33
34
        $driver->setDbname($dbName);
35
36
        self::assertInstanceOf(Database::class, $driver->getDatabase());
37
        self::assertEquals($dbName, $driver->getDatabase()->getDatabaseName());
38
    }
39
}
40