Completed
Push — master ( 0ed61c...03ecff )
by Joachim
15:52
created

PaymentTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 80
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGettersSetters() 0 69 1
A getPayment() 0 4 1
1
<?php
2
3
namespace Loevgaard\DandomainAltapayBundle\Tests\Entity;
4
5
use Loevgaard\DandomainAltapayBundle\Entity\Payment;
6
use PHPUnit\Framework\TestCase;
7
8
class PaymentTest extends TestCase
9
{
10
    public function testGettersSetters()
11
    {
12
        $payment = $this->getPayment();
13
14
        $created = \DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2017-10-01 04:00:00');
15
        $updated = \DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2017-10-01 04:00:01');
16
17
        $payment
18
            ->setId(1)
19
            ->setAltapayId('altapayid')
20
            ->setCardStatus('cardstatus')
21
            ->setCreditCardToken('cctoken')
22
            ->setCreditCardMaskedPan('ccmaskedpan')
23
            ->setThreeDSecureResult('3dres')
24
            ->setLiableForChargeback('liable')
25
            ->setBlacklistToken('blacklisttoken')
26
            ->setShop('shop')
27
            ->setTerminal('terminal')
28
            ->setTransactionStatus('transactionstatus')
29
            ->setReasonCode('reasoncode')
30
            ->setMerchantCurrency(208)
31
            ->setMerchantCurrencyAlpha('DKK')
32
            ->setCardHolderCurrency(700)
33
            ->setCardHolderCurrencyAlpha('EUR')
34
            ->setReservedAmount(250.5)
35
            ->setCapturedAmount(125.5)
36
            ->setRefundedAmount(300.4)
37
            ->setRecurringDefaultAmount(400.9)
38
            ->setCreatedDate($created)
39
            ->setUpdatedDate($updated)
40
            ->setPaymentNature('paymentnature')
41
            ->setSupportsRefunds(false)
42
            ->setSupportsRelease(false)
43
            ->setSupportsMultipleCaptures(true)
44
            ->setSupportsMultipleRefunds(true)
45
            ->setFraudRiskScore(13.37)
46
            ->setFraudExplanation('fraudexplanation')
47
        ;
48
49
        $this->assertSame(1, $payment->getId());
50
        $this->assertSame('altapayid', $payment->getAltapayId());
51
        $this->assertSame('cardstatus', $payment->getCardStatus());
52
        $this->assertSame('cctoken', $payment->getCreditCardToken());
53
        $this->assertSame('ccmaskedpan', $payment->getCreditCardMaskedPan());
54
        $this->assertSame('3dres', $payment->getThreeDSecureResult());
55
        $this->assertSame('liable', $payment->getLiableForChargeback());
56
        $this->assertSame('blacklisttoken', $payment->getBlacklistToken());
57
        $this->assertSame('shop', $payment->getShop());
58
        $this->assertSame('terminal', $payment->getTerminal());
59
        $this->assertSame('transactionstatus', $payment->getTransactionStatus());
60
        $this->assertSame('reasoncode', $payment->getReasonCode());
61
        $this->assertSame(208, $payment->getMerchantCurrency());
62
        $this->assertSame('DKK', $payment->getMerchantCurrencyAlpha());
63
        $this->assertSame(700, $payment->getCardHolderCurrency());
64
        $this->assertSame('EUR', $payment->getCardHolderCurrencyAlpha());
65
        $this->assertSame(250.5, $payment->getReservedAmount());
66
        $this->assertSame(125.5, $payment->getCapturedAmount());
67
        $this->assertSame(300.4, $payment->getRefundedAmount());
68
        $this->assertSame(400.9, $payment->getRecurringDefaultAmount());
69
        $this->assertSame($created, $payment->getCreatedDate());
70
        $this->assertSame($updated, $payment->getUpdatedDate());
71
        $this->assertSame('paymentnature', $payment->getPaymentNature());
72
        $this->assertSame(false, $payment->getSupportsRefunds());
73
        $this->assertSame(false, $payment->getSupportsRelease());
74
        $this->assertSame(true, $payment->getSupportsMultipleCaptures());
75
        $this->assertSame(true, $payment->getSupportsMultipleRefunds());
76
        $this->assertSame(13.37, $payment->getFraudRiskScore());
77
        $this->assertSame('fraudexplanation', $payment->getFraudExplanation());
78
    }
79
80
    /**
81
     * @return Payment
82
     */
83
    public function getPayment()
84
    {
85
        return $this->getMockForAbstractClass(Payment::class);
86
    }
87
}
88