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

ChannelMapTest::testConstructWithDuplicateKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 1
b 0
f 1
ccs 5
cts 5
cp 1
cc 1
nc 1
nop 0
crap 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\ChannelInterface;
12
use Daikon\MessageBus\Channel\ChannelMap;
13
use PHPUnit\Framework\TestCase;
14
15
final class ChannelMapTest extends TestCase
16
{
17 1
    public function testConstructWithSelf(): void
18
    {
19 1
        $channelMock = $this->createMock(ChannelInterface::class);
20 1
        $channelMap = new ChannelMap(['mock' => $channelMock]);
21 1
        $newMap = new ChannelMap($channelMap);
22 1
        $this->assertCount(1, $newMap);
23 1
        $this->assertFalse($channelMap === $newMap);
24 1
    }
25
26 1
    public function testPush(): void
27
    {
28 1
        $emptyMap = new ChannelMap;
29
        /** @var ChannelInterface $channelMock */
30 1
        $channelMock = $this->createMock(ChannelInterface::class);
31 1
        $channelMap = $emptyMap->with('mock', $channelMock);
32 1
        $this->assertCount(1, $channelMap);
33 1
        $this->assertEquals($channelMock, $channelMap->get('mock'));
34 1
        $this->assertTrue($emptyMap->isEmpty());
35 1
    }
36
}
37