CardHistoryTest::testCreateFromArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 9.392
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Tests\ValueObject;
4
5
use PHPUnit\Framework\TestCase;
6
use TrelloCycleTime\ValueObject\HistoryCard;
7
8
class CardHistoryTest extends TestCase
9
{
10
    public function testCreateFromArray()
11
    {
12
        $cardId = '1000';
13
        $name = 'name';
14
        $listBefore = 'listBefore';
15
        $listAfter = 'listAfter';
16
        $date = '2019-04-29 00:00:00';
17
        
18
        $data = [
19
            'data' => [
20
                'card' => [
21
                    'id' => $cardId,
22
                    'name' => $name,
23
                ],
24
                'listBefore' => [
25
                    'name' => $listBefore,
26
                ],
27
                'listAfter' => [
28
                    'name' => $listAfter,
29
                ]
30
            ],
31
            'date' =>  $date
32
        ];
33
34
        $cardHistory = HistoryCard::createFromArray($data);
35
36
        $this->assertEquals($cardId, $cardHistory->getId());
37
        $this->assertEquals($name, $cardHistory->getTitle());
38
        $this->assertEquals($listBefore, $cardHistory->getFrom());
39
        $this->assertEquals($listAfter, $cardHistory->getTo());
40
        $this->assertEquals($date, $cardHistory->getDate());
41
42
    }
43
}