Passed
Push — master ( 338ae5...3da373 )
by Mr
01:54
created

TransportMapTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructWithSelf() 0 7 1
A testPush() 0 9 1
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the daikon-cqrs/message-bus 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\MessageBus;
10
11
use Daikon\MessageBus\Channel\Subscription\Transport\TransportInterface;
12
use Daikon\MessageBus\Channel\Subscription\Transport\TransportMap;
13
use PHPUnit\Framework\TestCase;
14
15
final class TransportMapTest extends TestCase
16
{
17 1
    public function testConstructWithSelf(): void
18
    {
19 1
        $transportMock = $this->createMock(TransportInterface::class);
20 1
        $transportMap = new TransportMap(['mock' => $transportMock]);
21 1
        $newMap = new TransportMap($transportMap);
22 1
        $this->assertCount(1, $newMap);
23 1
        $this->assertFalse($transportMap === $newMap);
24 1
    }
25
26 1
    public function testPush(): void
27
    {
28 1
        $emptyMap = new TransportMap;
29
        /** @var TransportInterface $transportMock */
30 1
        $transportMock = $this->createMock(TransportInterface::class);
31 1
        $transportMap = $emptyMap->with('mock', $transportMock);
32 1
        $this->assertCount(1, $transportMap);
33 1
        $this->assertEquals($transportMock, $transportMap->get('mock'));
34 1
        $this->assertTrue($emptyMap->isEmpty());
35 1
    }
36
}
37