Passed
Push — develop ( 33219b...70059d )
by Remco
04:24
created

PaymentTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A test_set_and_get_transaction_id() 0 8 1
A test_construct() 0 4 1
A test_set_and_get_id() 0 8 1
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;
0 ignored issues
show
Bug introduced by
The type WP_UnitTestCase was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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 setting and getting the payment ID.
34
	 */
35
	public function test_set_and_get_id() {
36
		$payment = new Payment();
37
38
		$id = uniqid();
39
40
		$payment->set_id( $id );
41
42
		$this->assertEquals( $id, $payment->get_id() );
43
	}
44
45
	/** 
46
	 * Test setting and getting the payment transaction ID.
47
	 */
48
	public function test_set_and_get_transaction_id() {
49
		$payment = new Payment();
50
51
		$transaction_id = uniqid();
52
53
		$payment->set_transaction_id( $transaction_id );
54
55
		$this->assertEquals( $transaction_id, $payment->get_transaction_id() );
56
	}
57
}
58