Completed
Push — master ( 7c1eaa...80d841 )
by Joachim
15:53
created

CallbackTest::testGettersSetters()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 72
Code Lines 58

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 72
c 0
b 0
f 0
rs 9.102
cc 1
eloc 58
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Loevgaard\DandomainAltapayBundle\Tests\Entity;
4
5
use Loevgaard\DandomainAltapayBundle\Entity\Callback;
6
use Loevgaard\DandomainAltapayBundle\Entity\CallbackInterface;
7
use Loevgaard\DandomainAltapayBundle\Entity\Payment;
8
use PHPUnit\Framework\TestCase;
9
10
class CallbackTest extends TestCase
11
{
12
    public function testGettersSetters()
13
    {
14
        $callback = $this->getCallback();
15
        $payment = $this->getPayment();
16
17
        $callback
18
            ->setId(1)
19
            ->setOrderId(2)
20
            ->setStatus('status')
21
            ->setPayment($payment)
22
            ->setRequest('request')
23
            ->setAmount(100.5)
24
            ->setTransactionId('trans123')
25
            ->setCurrency(208)
26
            ->setLanguage('da')
27
            ->setAvsCode('avscode')
28
            ->setAvsText('avstext')
29
            ->setBlacklistToken('blacklisttoken')
30
            ->setCardholderMessageMustBeShown(true)
31
            ->setChecksum('checksum')
32
            ->setCreditCardToken('credit card token')
33
            ->setErrorMessage('error message')
34
            ->setFraudExplanation('fraud explanation')
35
            ->setFraudRecommendation('fraud recommendation')
36
            ->setFraudRiskScore(9.5)
37
            ->setTransactionInfo(['info'])
38
            ->setMerchantErrorMessage('merchant error')
39
            ->setType('type')
40
            ->setPaymentStatus('payment status')
41
            ->setMaskedCreditCard('masked cc')
42
            ->setNature('nature')
43
            ->setRequireCapture(false)
44
            ->setXml('xml')
45
        ;
46
47
        $this->assertSame(1, $callback->getId());
48
        $this->assertSame(2, $callback->getOrderId());
49
        $this->assertSame('status', $callback->getStatus());
50
        $this->assertSame($payment, $callback->getPayment());
51
        $this->assertSame('request', $callback->getRequest());
52
        $this->assertSame(100.5, $callback->getAmount());
53
        $this->assertSame('trans123', $callback->getTransactionId());
54
        $this->assertSame(208, $callback->getCurrency());
55
        $this->assertSame('da', $callback->getLanguage());
56
        $this->assertSame('avscode', $callback->getAvsCode());
57
        $this->assertSame('avstext', $callback->getAvsText());
58
        $this->assertSame('blacklisttoken', $callback->getBlacklistToken());
59
        $this->assertSame(true, $callback->isCardholderMessageMustBeShown());
60
        $this->assertSame('checksum', $callback->getChecksum());
61
        $this->assertSame('credit card token', $callback->getCreditCardToken());
62
        $this->assertSame('error message', $callback->getErrorMessage());
63
        $this->assertSame('fraud explanation', $callback->getFraudExplanation());
64
        $this->assertSame('fraud recommendation', $callback->getFraudRecommendation());
65
        $this->assertSame(9.5, $callback->getFraudRiskScore());
66
        $this->assertSame(['info'], $callback->getTransactionInfo());
67
        $this->assertSame('merchant error', $callback->getMerchantErrorMessage());
68
        $this->assertSame('type', $callback->getType());
69
        $this->assertSame('payment status', $callback->getPaymentStatus());
70
        $this->assertSame('masked cc', $callback->getMaskedCreditCard());
71
        $this->assertSame('nature', $callback->getNature());
72
        $this->assertSame(false, $callback->isRequireCapture());
73
        $this->assertSame('xml', $callback->getXml());
74
75
        /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
74% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
76
        $this->assertSame(1, $callback->getId());
77
        $this->assertSame('title', $callback->getTitle());
78
        $this->assertSame('sluuuug', $callback->getSlug());
79
        $this->assertSame('DK', $callback->getCountry());
80
        $this->assertSame(['EUR', 'DKK'], $callback->getCurrencies());
81
        $this->assertSame(['Nature 1', 'Nature 2'], $callback->getNatures());
82
        */
83
    }
84
85
    /**
86
     * @return CallbackInterface
87
     */
88
    public function getCallback()
89
    {
90
        return $this->getMockForAbstractClass(Callback::class);
91
    }
92
93
    /**
94
     * @return Payment
95
     */
96
    public function getPayment()
97
    {
98
        return $this->getMockForAbstractClass(Payment::class);
99
    }
100
}
101