Completed
Pull Request — master (#6)
by Laurens
03:26
created

CashPaymentTest::changedAmount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LauLamanApps\IzettleApi\Tests\Unit\Api\Purchase\Payment;
6
7
use LauLamanApps\IzettleApi\API\Purchase\Payment\CashPayment;
8
use Money\Money;
9
use PHPUnit\Framework\TestCase;
10
use Ramsey\Uuid\Uuid;
11
12
/**
13
 * @small
14
 */
15
final class CashPaymentTest extends TestCase
16
{
17
    /**
18
     * @test
19
     * @dataProvider getAmounts
20
     */
21
    public function changedAmount($shouldPay, $payed)
22
    {
23
        $shouldReceiveChange = ($payed - $shouldPay);
24
25
        $payment = new CashPayment(Uuid::uuid1(), Money::EUR($shouldPay), Money::EUR($payed));
26
27
        self::assertSame($shouldReceiveChange, (int) $payment->getChangeAmount()->getAmount());
28
    }
29
30 View Code Duplication
    public function getAmounts(): array
31
    {
32
        return [
33
            'positive 1' => [200, 500],
34
            'positive 2' => [1000, 250],
35
            'negative 1' => [-100, 0],
36
            'negative 2' => [-1000, -1000],
37
        ];
38
    }
39
}
40