Code Duplication    Length = 22-24 lines in 3 locations

tests/OnePayTest.php 2 locations

@@ 33-55 (lines=23) @@
30
     * @expectedException \yii\base\InvalidConfigException
31
     * @expectedExceptionMessage cannot be blank
32
     */
33
    public function testPurchase()
34
    {
35
        // Valid
36
        $responseData = $this->purchase([
37
            'ReturnURL' => 'http://localhost/',
38
            'OrderInfo' => time(),
39
            'Amount' => 500000,
40
            'TicketNo' => '127.0.0.1',
41
            'AgainLink' => 'http://localhost/',
42
            'Title' => 'Hello World',
43
            'MerchTxnRef' => time()
44
        ]);
45
46
        $this->assertTrue($responseData->getIsOk());
47
        $this->assertTrue(isset($responseData['redirect_url']));
48
49
        // Throws
50
        $this->purchase([
51
            'ReturnURL' => 'http://localhost/',
52
            'TicketNo' => '127.0.0.1',
53
            'AgainLink' => 'http://localhost/'
54
        ]);
55
    }
56
57
    /**
58
     * @expectedException \yii\base\InvalidConfigException
@@ 61-84 (lines=24) @@
58
     * @expectedException \yii\base\InvalidConfigException
59
     * @expectedExceptionMessage cannot be blank
60
     */
61
    public function testPurchaseInternational()
62
    {
63
        // Valid
64
        $this->gateway->international = true;
65
        $responseData = $this->purchase([
66
            'ReturnURL' => 'http://localhost/',
67
            'OrderInfo' => time(),
68
            'Amount' => 500000,
69
            'TicketNo' => '127.0.0.1',
70
            'AgainLink' => 'http://localhost/',
71
            'Title' => 'Hello World',
72
            'MerchTxnRef' => time()
73
        ]);
74
75
        $this->assertTrue($responseData->getIsOk());
76
        $this->assertTrue(isset($responseData['redirect_url']));
77
78
        // Throws
79
        $this->purchase([
80
            'ReturnURL' => 'http://localhost/',
81
            'TicketNo' => '127.0.0.1',
82
            'AgainLink' => 'http://localhost/'
83
        ]);
84
    }
85
86
    /**
87
     * @expectedException \yii\base\InvalidConfigException

tests/VnPaymentTest.php 1 location

@@ 33-54 (lines=22) @@
30
     * @expectedException \yii\base\InvalidConfigException
31
     * @expectedExceptionMessage cannot be blank
32
     */
33
    public function testPurchase()
34
    {
35
        // Valid
36
        $responseData = $this->purchase([
37
            'TxnRef' => time(),
38
            'OrderType' => 100000,
39
            'OrderInfo' => time(),
40
            'IpAddr' => '127.0.0.1',
41
            'Amount' => 1000000,
42
            'ReturnUrl' => 'http://localhost'
43
        ]);
44
45
        $this->assertTrue($responseData->getIsOk());
46
        $this->assertTrue(isset($responseData['redirect_url']));
47
48
        // Throws
49
        $this->purchase([
50
            'OrderType' => 100000,
51
            'IpAddr' => '127.0.0.1',
52
            'ReturnUrl' => 'http://localhost'
53
        ]);
54
    }
55
56
    /**
57
     * @expectedException \yii\base\InvalidConfigException