| @@ 39-57 (lines=19) @@ | ||
| 36 | * @expectedException \yii\base\InvalidConfigException |
|
| 37 | * @expectedExceptionMessage cannot be blank |
|
| 38 | */ |
|
| 39 | public function testPurchase() |
|
| 40 | { |
|
| 41 | // Valid |
|
| 42 | $responseData = $this->gateway->purchase([ |
|
| 43 | 'bank_code' => 'VCB', |
|
| 44 | 'buyer_fullname' => 'vxm', |
|
| 45 | 'buyer_email' => '[email protected]', |
|
| 46 | 'buyer_mobile' => '0909113911', |
|
| 47 | 'total_amount' => 10000000, |
|
| 48 | 'order_code' => microtime() |
|
| 49 | ]); |
|
| 50 | ||
| 51 | $this->assertTrue($responseData->getIsOk()); |
|
| 52 | $this->assertTrue(isset($responseData['checkout_url'])); |
|
| 53 | ||
| 54 | // Throws |
|
| 55 | $this->gateway->purchase([]); |
|
| 56 | ||
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * @expectedException \yii\base\InvalidConfigException |
|
| @@ 34-52 (lines=19) @@ | ||
| 31 | * @expectedException \yii\base\InvalidConfigException |
|
| 32 | * @expectedExceptionMessage cannot be blank |
|
| 33 | */ |
|
| 34 | public function testPurchase() |
|
| 35 | { |
|
| 36 | // valid |
|
| 37 | $responseData = $this->gateway->purchase([ |
|
| 38 | 'order_id' => 2, |
|
| 39 | 'total_amount' => 500000, |
|
| 40 | 'url_success' => '/' |
|
| 41 | ]); |
|
| 42 | ||
| 43 | $this->assertTrue($responseData->getIsOk()); |
|
| 44 | $this->assertTrue(isset($responseData['redirect_url'])); |
|
| 45 | ||
| 46 | // throws |
|
| 47 | $this->gateway->purchase([ |
|
| 48 | 'order_id' => 1, |
|
| 49 | 'url_success' => '/' |
|
| 50 | ]); |
|
| 51 | ||
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @expectedException \yii\base\InvalidConfigException |
|