Passed
Push — main ( 061772...28b955 )
by Remco
07:49 queued 12s
created

TrackingCodeTest::test()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
1
<?php
2
/**
3
 * Tracking Code Test
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2020 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
/**
14
 * Tracking Code Test
15
 *
16
 * @author  Remco Tolsma
17
 * @version 1.0.0
18
 * @since   1.0.0
19
 */
20
class TrackingCodeTest extends \WP_UnitTestCase {
21
	/**
22
	 * Test.
23
	 */
24
	public function test() {
25
		$tracking_code = TrackingCode::from_id( 1 );
26
27
		$this->assertEquals( '00000001', \strval( $tracking_code ) );
28
		$this->assertEquals( '"00000001"', \wp_json_encode( $tracking_code ) );
29
30
		$tracking_code = TrackingCode::from_id( 1234567890 );
31
32
		$this->assertEquals( '1234567890', \strval( $tracking_code ) );
33
		$this->assertEquals( '"1234567890"', \wp_json_encode( $tracking_code ) );
34
	}
35
36
	/**
37
	 * Test.
38
	 */
39
	public function test_exception() {
40
		$this->expectException( \InvalidArgumentException::class );
41
		$this->expectExceptionMessage( 'Minimum length: 8 characters.' );
42
43
		new TrackingCode( '1' );
44
	}
45
}
46