GatewayTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 53
rs 10
c 0
b 0
f 0

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
 * OKPAY driver for Omnipay PHP payment library.
4
 *
5
 * @link      https://github.com/hiqdev/omnipay-okpay
6
 * @package   omnipay-okpay
7
 * @license   MIT
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace Omnipay\OKPAY;
12
13
use Omnipay\Tests\GatewayTestCase;
14
15
class GatewayTest extends GatewayTestCase
16
{
17
    public $gateway;
18
19
    private $purse          = '[email protected]';
20
//    private $secret         = 'sDf#$Sdf#$%';
21
    private $testMode       = true;
22
    private $transactionId  = 'sadf2345asf';
23
    private $description    = 'Test completePurchase description';
24
    private $currency       = 'USD';
25
    private $amount         = '12.46';
26
27
    public function setUp()
28
    {
29
        parent::setUp();
30
31
        $this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest());
32
        $this->gateway->setPurse($this->purse);
33
        $this->gateway->setTestMode($this->testMode);
34
    }
35
36
    public function testGateway()
37
    {
38
        $this->assertSame($this->purse,     $this->gateway->getPurse());
39
        $this->assertSame($this->testMode,  $this->gateway->getTestMode());
40
    }
41
42
    public function testCompletePurchase()
43
    {
44
        $request = $this->gateway->completePurchase([
45
            'transactionId' => $this->transactionId,
46
        ]);
47
48
        $this->assertSame($this->purse,         $request->getPurse());
49
        $this->assertSame($this->testMode,      $request->getTestMode());
50
        $this->assertSame($this->transactionId, $request->getTransactionId());
51
    }
52
53
    public function testPurchase()
54
    {
55
        $request = $this->gateway->purchase([
56
            'transactionId' => $this->transactionId,
57
            'description'   => $this->description,
58
            'currency'      => $this->currency,
59
            'amount'        => $this->amount,
60
        ]);
61
62
        $this->assertSame($this->transactionId, $request->getTransactionId());
63
        $this->assertSame($this->description,   $request->getDescription());
64
        $this->assertSame($this->currency,      $request->getCurrency());
65
        $this->assertSame($this->amount,        $request->getAmount());
66
    }
67
}
68