Test Failed
Push — master ( b6dff7...455f41 )
by Gabriel
12:43 queued 11s
created

HasConnectionsTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_getDefaultConnection() 0 10 1
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
Documentation introduced by
false is of type boolean, but the function expects a object<PDO>|object<Closure>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
20
        $manager->setConnection($connection, 'main');
21
22
        $connectionFromManager = $manager->connection();
23
        self::assertSame($connection, $connectionFromManager);
24
    }
25
}
26