ResponseCodesTest::test_transform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\TargetPay;
4
5
use PHPUnit_Framework_TestCase;
6
use Pronamic\WordPress\Pay\Payments\PaymentStatus as Core_Statuses;
7
8
/**
9
 * Title: TargetPay response codes tests
10
 * Description:
11
 * Copyright: 2005-2021 Pronamic
12
 * Company: Pronamic
13
 *
14
 * @author  Remco Tolsma
15
 * @version 2.0.3
16
 * @since   1.0.0
17
 */
18
class ResponseCodesTest extends PHPUnit_Framework_TestCase {
19
	/**
20
	 * Test transform
21
	 *
22
	 * @dataProvider status_matrix_provider
23
	 *
24
	 * @param $response_code
25
	 * @param $expected
26
	 */
27
	public function test_transform( $response_code, $expected ) {
28
		$status = Statuses::transform( $response_code );
29
30
		$this->assertEquals( $expected, $status );
31
	}
32
33
	public function status_matrix_provider() {
34
		return array(
35
			array( Statuses::OK, Core_Statuses::SUCCESS ),
36
			array( Statuses::TRANSACTION_NOT_COMPLETED, Core_Statuses::OPEN ),
37
			array( Statuses::TRANSACTION_CANCLLED, Core_Statuses::CANCELLED ),
38
			array( Statuses::TRANSACTION_EXPIRED, Core_Statuses::EXPIRED ),
39
			array( 'not existing response code', null ),
40
		);
41
	}
42
}
43