Passed
Push — master ( 3ec735...0b5e67 )
by Chema
01:36 queued 14s
created

testConditionNamesGroupBySymbol()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 12
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chemaclass\StockTickerTests\Unit\Domain\Notifier;
6
7
use Chemaclass\StockTicker\Domain\Notifier\NotifyResult;
8
use Chemaclass\StockTicker\Domain\ReadModel\Company;
9
use Chemaclass\StockTicker\Domain\ReadModel\Symbol;
10
use PHPUnit\Framework\TestCase;
11
12
final class NotifyResultTest extends TestCase
13
{
14
    public function testConditionNamesGroupBySymbol(): void
15
    {
16
        $notifyResult = (new NotifyResult())
17
            ->add($this->createCompany('SYMBOL_1'), ['condition 1', 'condition 2'])
18
            ->add($this->createCompany('SYMBOL_2'), ['condition 3']);
19
20
        self::assertEquals(
21
            [
22
                'SYMBOL_1' => ['condition 1', 'condition 2'],
23
                'SYMBOL_2' => ['condition 3'],
24
            ],
25
            $notifyResult->conditionNamesGroupBySymbol()
26
        );
27
    }
28
29
    private function createCompany(string $symbol): Company
30
    {
31
        return new Company(
32
            Symbol::fromString($symbol),
33
            ['key1' => 'value 1']
34
        );
35
    }
36
}
37