OldCompletePurchaseRequestTest::testSendData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * InterKassa driver for the Omnipay PHP payment processing library
4
 *
5
 * @link      https://github.com/hiqdev/omnipay-interkassa
6
 * @package   omnipay-interkassa
7
 * @license   MIT
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace Omnipay\InterKassa\Tests\Message;
12
13
use Omnipay\InterKassa\Message\OldCompletePurchaseRequest;
14
use Omnipay\InterKassa\Stubs\OldCompletePurchaseRequestStub;
15
use Symfony\Component\HttpFoundation\Request as HttpRequest;
16
17
class OldCompletePurchaseRequestTest extends CompletePurchaseRequestTest
18
{
19
    /**
20
     * @var OldCompletePurchaseRequest
21
     */
22
    protected $request;
23
24
    /**
25
     * @var OldCompletePurchaseRequestStub
26
     */
27
    protected $stub;
28
29 View Code Duplication
    public function setUp()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
    {
31
        parent::setUp();
32
33
        $stub = $this->stub = new OldCompletePurchaseRequestStub();
34
35
        $httpRequest = new HttpRequest([], [
36
            'ik_shop_id' => $stub->purse,
37
            'ik_payment_id' => $stub->transactionId,
38
            'ik_payment_desc' => $stub->description,
39
            'ik_payment_amount' => $stub->amount,
40
            'ik_payment_timestamp' => $stub->time,
41
            'ik_sign_hash' => $stub->sign,
42
            'ik_payment_state' => $stub->state,
43
        ]);
44
45
        $this->request = new OldCompletePurchaseRequest($this->getHttpClient(), $httpRequest);
46
        $this->request->initialize([
47
            'purse' => $stub->purse,
48
            'signAlgorithm' => $stub->signAlgorithm,
49
            'signKey' => $stub->signKey,
50
        ]);
51
    }
52
53 View Code Duplication
    public function testGetData()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54
    {
55
        $stub = $this->stub;
56
        $data = $this->request->getData();
57
58
        $this->assertSame($stub->purse, $data['ik_shop_id']);
59
        $this->assertSame($stub->transactionId, $data['ik_payment_id']);
60
        $this->assertSame($stub->description, $data['ik_payment_desc']);
61
        $this->assertSame($stub->amount, $data['ik_payment_amount']);
62
        $this->assertSame($stub->time, $data['ik_payment_timestamp']);
63
    }
64
65
    public function testSendData()
66
    {
67
        $data = $this->request->getData();
68
        $response = $this->request->sendData($data);
69
        $this->assertSame('Omnipay\InterKassa\Message\OldCompletePurchaseResponse', get_class($response));
70
    }
71
}
72