HasConnectionsTest::test_getDefaultConnection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
namespace Nip\Database\Tests\Manager;
4
5
use Nip\Database\Connections\Connection;
6
use Nip\Database\DatabaseManager;
7
use Nip\Database\Tests\AbstractTest;
8
9
/**
10
 * Class HasConnectionsTest
11
 * @package Nip\Database\Tests\Manager
12
 */
13
class HasConnectionsTest extends AbstractTest
14
{
15
    public function test_getDefaultConnection()
16
    {
17
        $manager = new DatabaseManager();
18
19
        $connection = new Connection(false);
0 ignored issues
show
Bug introduced by
false of type false is incompatible with the type Closure|PDO expected by parameter $pdo of Nip\Database\Connections\Connection::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

19
        $connection = new Connection(/** @scrutinizer ignore-type */ false);
Loading history...
20
        $manager->setConnection($connection, 'main');
21
22
        $connectionFromManager = $manager->connection();
23
        self::assertSame($connection, $connectionFromManager);
24
    }
25
}
26