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

MigrationAdapterMapTest::testPush()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
ccs 7
cts 7
cp 1
crap 1
rs 10
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\Migration;
10
11
use Daikon\Dbal\Migration\MigrationAdapterInterface;
12
use Daikon\Dbal\Migration\MigrationAdapterMap;
13
use PHPUnit\Framework\TestCase;
14
15
final class MigrationAdapterMapTest extends TestCase
16
{
17 1
    public function testConstructWithSelf(): void
18
    {
19 1
        $adapterMock = $this->createMock(MigrationAdapterInterface::class);
20 1
        $adapterMap = new MigrationAdapterMap(['mock' => $adapterMock]);
21 1
        $newMap = new MigrationAdapterMap($adapterMap);
22 1
        $this->assertCount(1, $newMap);
23 1
        $this->assertNotSame($adapterMap, $newMap);
24 1
        $this->assertEquals($adapterMap, $newMap);
25 1
    }
26
27 1
    public function testPush(): void
28
    {
29 1
        $emptyMap = new MigrationAdapterMap;
30 1
        $adapterMock = $this->createMock(MigrationAdapterInterface::class);
31 1
        $adapterMap = $emptyMap->with('mock', $adapterMock);
32 1
        $this->assertCount(1, $adapterMap);
33 1
        $this->assertEquals($adapterMock, $adapterMap->get('mock'));
34 1
        $this->assertTrue($emptyMap->isEmpty());
35 1
    }
36
}
37