|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Payment test |
|
4
|
|
|
* |
|
5
|
|
|
* @author Pronamic <[email protected]> |
|
6
|
|
|
* @copyright 2005-2018 Pronamic |
|
7
|
|
|
* @license GPL-3.0-or-later |
|
8
|
|
|
* @package Pronamic\WordPress\Pay\Payments |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Pronamic\WordPress\Pay\Payments; |
|
12
|
|
|
|
|
13
|
|
|
use stdClass; |
|
14
|
|
|
use WP_UnitTestCase; |
|
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Payment test |
|
18
|
|
|
* |
|
19
|
|
|
* @author Remco Tolsma |
|
20
|
|
|
* @version 1.0 |
|
21
|
|
|
*/ |
|
22
|
|
|
class PaymentTest extends WP_UnitTestCase { |
|
23
|
|
|
/** |
|
24
|
|
|
* Test construct payment object. |
|
25
|
|
|
*/ |
|
26
|
|
|
public function test_construct() { |
|
27
|
|
|
$payment = new Payment(); |
|
28
|
|
|
|
|
29
|
|
|
$this->assertInstanceOf( __NAMESPACE__ . '\Payment', $payment ); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Test getting no payment. |
|
34
|
|
|
* |
|
35
|
|
|
* @see https://github.com/easydigitaldownloads/easy-digital-downloads/blob/2.8.18/tests/tests-payment-class.php#L70-L79 |
|
36
|
|
|
*/ |
|
37
|
|
|
public function test_getting_no_payment() { |
|
38
|
|
|
$payment = new Payment(); |
|
39
|
|
|
|
|
40
|
|
|
$this->assertNull( $payment->get_id() ); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Test setting and getting the payment ID. |
|
45
|
|
|
*/ |
|
46
|
|
|
public function test_set_and_get_id() { |
|
47
|
|
|
$payment = new Payment(); |
|
48
|
|
|
|
|
49
|
|
|
$id = uniqid(); |
|
50
|
|
|
|
|
51
|
|
|
$payment->set_id( $id ); |
|
52
|
|
|
|
|
53
|
|
|
$this->assertEquals( $id, $payment->get_id() ); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Test setting and getting the payment transaction ID. |
|
58
|
|
|
*/ |
|
59
|
|
|
public function test_set_and_get_transaction_id() { |
|
60
|
|
|
$payment = new Payment(); |
|
61
|
|
|
|
|
62
|
|
|
$transaction_id = uniqid(); |
|
63
|
|
|
|
|
64
|
|
|
$payment->set_transaction_id( $transaction_id ); |
|
65
|
|
|
|
|
66
|
|
|
$this->assertEquals( $transaction_id, $payment->get_transaction_id() ); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Test setting and getting the payment status. |
|
71
|
|
|
*/ |
|
72
|
|
|
public function test_set_and_get_status() { |
|
73
|
|
|
$payment = new Payment(); |
|
74
|
|
|
|
|
75
|
|
|
$status = 'completed'; |
|
76
|
|
|
|
|
77
|
|
|
$payment->set_status( $status ); |
|
78
|
|
|
|
|
79
|
|
|
$this->assertEquals( $status, $payment->get_status() ); |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths