Code Duplication    Length = 28-28 lines in 2 locations

tests/CycleTimeCalculatorTest.php 2 locations

@@ 31-58 (lines=28) @@
28
        $this->assertEquals([], $this->cycleTimeCalculator->getTimeCards());
29
    }
30
31
    public function testCalculateFromCardHistory()
32
    {
33
        $cardId = 1;
34
        $fromKey = 'from';
35
        $toKey = 'to';
36
        $fromDate = '2019-05-25 00:00:00';
37
        $toDate = '2019-05-26 00:00:00';
38
39
        $historyCard = $this->prophesize(HistoryCard::class);
40
        $historyCard->getId()->willReturn($cardId);
41
        $historyCard->getFrom()->willReturn($fromKey);
42
        $historyCard->getTo()->willReturn($toKey);
43
44
        $timeCard = $this->prophesize(TimeCard::class);
45
        $timeCard->getId()->willReturn($cardId);
46
        $timeCard->calculateDayDifferenceBetweenColumns($fromKey, $fromDate, $toKey, $toDate)->shouldBeCalled();
47
48
        $this->historyCards->getCardHistories()->willReturn([$historyCard->reveal()]);
49
        $this->historyCards->getByCardIdAndTo($cardId, $fromKey)->willReturn($fromDate);
50
        $this->historyCards->getByCardIdAndTo($cardId, $toKey)->willReturn($toDate);
51
52
        $timeCardsCollection = [
53
            $timeCard->reveal()
54
        ];
55
56
        $this->cycleTimeCalculator = new CycleTimeCalculator($timeCardsCollection, $this->historyCards->reveal());
57
        $this->cycleTimeCalculator->calculateFromCardHistory();
58
    }
59
60
    public function testCalculateWithStaticFromAndTo()
61
    {
@@ 60-87 (lines=28) @@
57
        $this->cycleTimeCalculator->calculateFromCardHistory();
58
    }
59
60
    public function testCalculateWithStaticFromAndTo()
61
    {
62
        $cardId = 1;
63
        $fromKey = 'from';
64
        $toKey = 'to';
65
        $fromDate = '2019-05-25 00:00:00';
66
        $toDate = '2019-05-26 00:00:00';
67
68
        $historyCard = $this->prophesize(HistoryCard::class);
69
        $historyCard->getId()->willReturn($cardId);
70
        $historyCard->getFrom()->willReturn($fromKey);
71
        $historyCard->getTo()->willReturn($toKey);
72
73
        $timeCard = $this->prophesize(TimeCard::class);
74
        $timeCard->getId()->willReturn($cardId);
75
        $timeCard->calculateDayDifferenceBetweenColumns($fromKey, $fromDate, $toKey, $toDate)->shouldBeCalled();
76
77
        $this->historyCards->getCardHistories()->willReturn([$historyCard->reveal()]);
78
        $this->historyCards->getByCardIdAndTo($cardId, $fromKey)->willReturn($fromDate);
79
        $this->historyCards->getByCardIdAndTo($cardId, $toKey)->willReturn($toDate);
80
81
        $timeCardsCollection = [
82
            $timeCard->reveal()
83
        ];
84
85
        $this->cycleTimeCalculator = new CycleTimeCalculator($timeCardsCollection, $this->historyCards->reveal());
86
        $this->cycleTimeCalculator->calculateWithStaticFromAndTo($fromKey, $toKey);
87
    }
88
89
    public function testCalculateWithStaticFromAndToNull()
90
    {