ConfigStrategyTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetId() 0 17 1
A testMissingRecord() 0 14 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DataFlow\Writer\Dbal\UpdateStrategy;
5
6
use PHPUnit\Framework\TestCase;
7
use SlayerBirden\DataFlow\Data\SimpleBag;
8
9
class ConfigStrategyTest extends TestCase
10
{
11
    public function testGetId()
12
    {
13
        $strategy = new ConfigStrategy([
14
            'name' => null,
15
            'team' => 'avengers',
16
        ]);
17
18
        $bag = new SimpleBag([
19
            'id' => 0,
20
            'name' => 'Hulk',
21
        ]);
22
23
        $this->assertEquals([
24
            'name' => 'Hulk',
25
            'team' => 'avengers',
26
        ], $strategy->getRecordIdentifier($bag));
27
    }
28
29
    /**
30
     * @expectedException \SlayerBirden\DataFlow\Writer\Dbal\UpdateStrategy\InvalidConfigException
31
     */
32
    public function testMissingRecord()
33
    {
34
        $strategy = new ConfigStrategy([
35
            'name' => null,
36
            'team' => 'avengers',
37
        ]);
38
39
        $bag = new SimpleBag([
40
            'id' => 0,
41
            'nickname' => 'Hulk',
42
        ]);
43
44
        $strategy->getRecordIdentifier($bag);
45
    }
46
}
47