Completed
Push — master ( a3da9c...ba4a7f )
by Tobias
23:20
created

testWithEqualPayments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 5
1
<?php
2
3
namespace Nyholm\EffectiveInterest;
4
5
use PHPUnit\Framework\TestCase;
6
7
class CalculatorEqualPaymentsTest extends TestCase
8
{
9
    /**
10
     * @dataProvider generator
11
     */
12
    public function testWithEqualPayments(float $correctValue, int $principal, int $payments, int $numberOfMonths, float $guess)
13
    {
14
        $calculator = new Calculator();
15
        $interest = $calculator->withEqualPayments($principal, $payments, $numberOfMonths, $guess);
16
        $this->assertEquals($correctValue, $interest, 'Failed to calculate effective interest with specified payments.', 0.00001);
17
    }
18
19
    public function generator()
20
    {
21
        return [
22
            [0.1128, 11200, 291, 48, 0.02],
23
        ];
24
    }
25
26
}
27