Passed
Push — master ( 86c80a...6fdd2c )
by Mr
06:46
created

ConnectorMapTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 20
ccs 15
cts 15
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructWithSelf() 0 8 1
A testPush() 0 8 1
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the daikon-cqrs/dbal project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Daikon\Tests\Dbal\Connector;
10
11
use Daikon\Dbal\Connector\ConnectorInterface;
12
use Daikon\Dbal\Connector\ConnectorMap;
13
use PHPUnit\Framework\TestCase;
14
15
final class ConnectorMapTest extends TestCase
16
{
17 1
    public function testConstructWithSelf(): void
18
    {
19 1
        $connectorMock = $this->createMock(ConnectorInterface::class);
20 1
        $connectorMap = new ConnectorMap(['mock' => $connectorMock]);
21 1
        $newMap = new ConnectorMap($connectorMap);
22 1
        $this->assertCount(1, $newMap);
23 1
        $this->assertNotSame($connectorMap, $newMap);
24 1
        $this->assertEquals($connectorMap, $newMap);
25 1
    }
26
27 1
    public function testPush(): void
28
    {
29 1
        $emptyMap = new ConnectorMap;
30 1
        $connectorMock = $this->createMock(ConnectorInterface::class);
31 1
        $connectorMap = $emptyMap->with('mock', $connectorMock);
32 1
        $this->assertCount(1, $connectorMap);
33 1
        $this->assertEquals($connectorMock, $connectorMap->get('mock'));
34 1
        $this->assertTrue($emptyMap->isEmpty());
35 1
    }
36
}
37