Code Duplication    Length = 16-16 lines in 2 locations

tests/unit/formula/FormulaEngineTest.php 2 locations

@@ 31-46 (lines=16) @@
28
        $this->engine = new FormulaEngine();
29
    }
30
31
    public function testSimpleDiscount()
32
    {
33
        $date = '2018-08-01';
34
        $rate = '2';
35
        $reason = 'test reason';
36
        $formula = $this->engine->build("discount.fixed('$rate%').since('$date').reason('$reason')");
37
38
        $this->assertInstanceOf(FixedDiscount::class, $formula);
39
        $this->assertSame($rate, $formula->getValue()->getValue());
40
        $this->assertTrue($formula->isRelative());
41
        $this->assertInstanceOf(Since::class, $formula->getSince());
42
        $this->assertEquals(new DateTimeImmutable($date), $formula->getSince()->getValue());
43
        $this->assertInstanceOf(Reason::class, $formula->getReason());
44
        $this->assertSame($reason, $formula->getReason()->getValue());
45
        $this->assertNull($formula->getTill());
46
    }
47
48
    public function testSimpleLeasing()
49
    {
@@ 48-63 (lines=16) @@
45
        $this->assertNull($formula->getTill());
46
    }
47
48
    public function testSimpleLeasing()
49
    {
50
        $date = '2018-08-01';
51
        $num = 2;
52
        $reason = 'test reason';
53
        $formula = $this->engine->build("leasing.since('$date').lasts('$num months').reason('$reason')");
54
55
        $this->assertInstanceOf(Leasing::class, $formula);
56
        $this->assertInstanceOf(MonthPeriod::class, $formula->getTerm());
57
        $this->assertSame($num, $formula->getTerm()->getValue());
58
        $this->assertInstanceOf(Since::class, $formula->getSince());
59
        $this->assertEquals(new DateTimeImmutable($date), $formula->getSince()->getValue());
60
        $this->assertInstanceOf(Reason::class, $formula->getReason());
61
        $this->assertSame($reason, $formula->getReason()->getValue());
62
        $this->assertNull($formula->getTill());
63
    }
64
}
65