|
@@ 70-89 (lines=20) @@
|
| 67 |
|
]); |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
public function testSendRequest() |
| 71 |
|
{ |
| 72 |
|
$quote = $this->getMockBuilder(Quote::class)->disableOriginalConstructor()->getMock(); |
| 73 |
|
$quote->method('getGrandTotal')->willReturn(123); |
| 74 |
|
$quote->method('getQuoteCurrencyCode')->willReturn('EUR'); |
| 75 |
|
|
| 76 |
|
$payment = $this->getMockBuilder(Paypal::class)->disableOriginalConstructor()->getMock(); |
| 77 |
|
$payment->method('getOperationMode')->willReturn('test'); |
| 78 |
|
$payment->method('getSuccessUrl')->willReturn('http://testdomain.com'); |
| 79 |
|
$payment->method('errorurl')->willReturn('http://testdomain.com'); |
| 80 |
|
$payment->method('backurl')->willReturn('http://testdomain.com'); |
| 81 |
|
|
| 82 |
|
$this->shopHelper->method('getConfigParam')->willReturn('12345'); |
| 83 |
|
|
| 84 |
|
$response = ['status' => 'APPROVED']; |
| 85 |
|
$this->apiHelper->method('sendApiRequest')->willReturn($response); |
| 86 |
|
|
| 87 |
|
$result = $this->classToTest->sendRequest($quote, $payment, 100); |
| 88 |
|
$this->assertEquals($response, $result); |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
public function testSendRequestNoWorkorderId() |
| 92 |
|
{ |
|
@@ 91-110 (lines=20) @@
|
| 88 |
|
$this->assertEquals($response, $result); |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
public function testSendRequestNoWorkorderId() |
| 92 |
|
{ |
| 93 |
|
$quote = $this->getMockBuilder(Quote::class)->disableOriginalConstructor()->getMock(); |
| 94 |
|
$quote->method('getGrandTotal')->willReturn(123); |
| 95 |
|
$quote->method('getQuoteCurrencyCode')->willReturn('EUR'); |
| 96 |
|
|
| 97 |
|
$payment = $this->getMockBuilder(Paypal::class)->disableOriginalConstructor()->getMock(); |
| 98 |
|
$payment->method('getOperationMode')->willReturn('test'); |
| 99 |
|
$payment->method('getSuccessUrl')->willReturn('http://testdomain.com'); |
| 100 |
|
$payment->method('errorurl')->willReturn('http://testdomain.com'); |
| 101 |
|
$payment->method('backurl')->willReturn('http://testdomain.com'); |
| 102 |
|
|
| 103 |
|
$this->shopHelper->method('getConfigParam')->willReturn('12345'); |
| 104 |
|
|
| 105 |
|
$response = ['status' => 'APPROVED']; |
| 106 |
|
$this->apiHelper->method('sendApiRequest')->willReturn($response); |
| 107 |
|
|
| 108 |
|
$result = $this->classToTest->sendRequest($quote, $payment); |
| 109 |
|
$this->assertEquals($response, $result); |
| 110 |
|
} |
| 111 |
|
} |
| 112 |
|
|