wp-pay-gateways /
payvision
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Result Code Test |
||
| 4 | * |
||
| 5 | * @author Pronamic <[email protected]> |
||
| 6 | * @copyright 2005-2021 Pronamic |
||
| 7 | * @license GPL-3.0-or-later |
||
| 8 | * @package Pronamic\WordPress\Pay\Gateways\Payvision |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace Pronamic\WordPress\Pay\Gateways\Payvision; |
||
| 12 | |||
| 13 | use Pronamic\WordPress\Pay\Payments\PaymentStatus; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Result Code Test |
||
| 17 | * |
||
| 18 | * @author Remco Tolsma |
||
| 19 | * @version 1.1.0 |
||
| 20 | * @since 1.0.0 |
||
| 21 | */ |
||
| 22 | class ResultCodeTest extends \WP_UnitTestCase { |
||
| 23 | /** |
||
| 24 | * Test. |
||
| 25 | */ |
||
| 26 | public function test() { |
||
| 27 | $this->assertEquals( 0, ResultCode::OK ); |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Test to core. |
||
| 32 | * |
||
| 33 | * @param string $result_code Result code. |
||
| 34 | * @param string $expected Expected value. |
||
| 35 | * @dataProvider provider_test_to_core |
||
| 36 | */ |
||
| 37 | public function test_to_core( $result_code, $expected ) { |
||
| 38 | $payment_status = ResultCode::to_core( $result_code ); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 39 | |||
| 40 | $this->assertEquals( $expected, $payment_status ); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Result code data provider. |
||
| 45 | * |
||
| 46 | * @return array<int, string|null> |
||
| 47 | */ |
||
| 48 | public function provider_test_to_core() { |
||
| 49 | return array( |
||
| 50 | array( ResultCode::CUSTOMER_ERROR, PaymentStatus::CANCELLED ), |
||
| 51 | array( ResultCode::DECLINED, PaymentStatus::FAILURE ), |
||
| 52 | array( ResultCode::FAILED, PaymentStatus::FAILURE ), |
||
| 53 | array( ResultCode::OK, PaymentStatus::SUCCESS ), |
||
| 54 | array( ResultCode::WAITING, PaymentStatus::OPEN ), |
||
| 55 | array( ResultCode::PENDING, PaymentStatus::OPEN ), |
||
| 56 | array( ResultCode::TIMEOUT, PaymentStatus::EXPIRED ), |
||
| 57 | array( -1000, null ), |
||
| 58 | ); |
||
| 59 | } |
||
| 60 | } |
||
| 61 |