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

GatewayTest::testGateway()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
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