Completed
Push — master ( 8fe2d8...225854 )
by Andrii
20:54 queued 20:54
created

GatewayTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 1
A testGateway() 0 5 1
A testCompletePurchase() 0 10 1
A testPurchase() 0 14 1
1
<?php
2
3
/*
4
 * InterKassa driver for the Omnipay PHP payment processing library
5
 *
6
 * @link      https://github.com/hiqdev/omnipay-interkassa
7
 * @package   omnipay-interkassa
8
 * @license   MIT
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace Omnipay\InterKassa\Tests;
13
14
use Omnipay\InterKassa\Gateway;
15
use Omnipay\Tests\GatewayTestCase;
16
17
class GatewayTest extends GatewayTestCase
18
{
19
    /**
20
     * @var Gateway
21
     */
22
    public $gateway;
23
24
    protected $purse = '887ac1234c1eeee1488b156b';
25
    protected $secret = 'Zp2zfdSJzbS61L32';
26
    protected $transactionId = 'ID_123456';
27
    protected $description = 'Test completePurchase description';
28
    protected $currency = 'USD';
29
    protected $amount = '12.46';
30
31
    public function setUp()
32
    {
33
        parent::setUp();
34
35
        $this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest());
36
        $this->gateway->setPurse($this->purse);
37
        $this->gateway->setSecret($this->secret);
38
    }
39
40
    public function testGateway()
41
    {
42
        $this->assertSame($this->purse, $this->gateway->getPurse());
43
        $this->assertSame($this->secret, $this->gateway->getSecret());
44
    }
45
46
    public function testCompletePurchase()
47
    {
48
        $request = $this->gateway->completePurchase([
49
            'transactionId' => $this->transactionId,
50
        ]);
51
52
        $this->assertSame($this->purse, $request->getPurse());
53
        $this->assertSame($this->secret, $request->getSecret());
54
        $this->assertSame($this->transactionId, $request->getTransactionId());
55
    }
56
57
    public function testPurchase()
58
    {
59
        $request = $this->gateway->purchase([
60
            'transactionId' => $this->transactionId,
61
            'description' => $this->description,
62
            'currency' => $this->currency,
63
            'amount' => $this->amount,
64
        ]);
65
66
        $this->assertSame($this->transactionId, $request->getTransactionId());
67
        $this->assertSame($this->description, $request->getDescription());
68
        $this->assertSame($this->currency, $request->getCurrency());
69
        $this->assertSame($this->amount, $request->getAmount());
70
    }
71
}
72