DataHelperTest   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 29
dl 0
loc 69
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A test_ans16() 0 8 1
A test_n() 0 8 1
A test_ans() 0 8 1
A test_an16() 0 8 1
A test_an() 0 8 1
A test_an32() 0 8 1
A test_ans32() 0 8 1
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\IDealBasic;
4
5
/**
6
 * Title: iDEAL Basic data helper tests
7
 * Description:
8
 * Copyright: 2005-2021 Pronamic
9
 * Company: Pronamic
10
 *
11
 * @author  Remco Tolsma
12
 * @version 2.0.0
13
 * @since   1.0.0
14
 */
15
class DataHelperTest extends \PHPUnit_Framework_TestCase {
16
	public function test_an() {
17
		$test = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
18
19
		$expected = ' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
20
21
		$text = DataHelper::an( $test );
22
23
		$this->assertEquals( $expected, $text );
24
	}
25
26
	public function test_an16() {
27
		$test = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
28
29
		$expected = ' 0123456789ABCDE';
30
31
		$text = DataHelper::an16( $test );
32
33
		$this->assertEquals( $expected, $text );
34
	}
35
36
	public function test_an32() {
37
		$test = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
38
39
		$expected = ' 0123456789ABCDEFGHIJKLMNOPQRSTU';
40
41
		$text = DataHelper::an32( $test );
42
43
		$this->assertEquals( $expected, $text );
44
	}
45
46
	public function test_ans() {
47
		$test = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
48
49
		$expected = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
50
51
		$text = DataHelper::ans( $test );
52
53
		$this->assertEquals( $expected, $text );
54
	}
55
56
	public function test_ans16() {
57
		$test = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
58
59
		$expected = '0123456789ABCDEF';
60
61
		$text = DataHelper::ans16( $test );
62
63
		$this->assertEquals( $expected, $text );
64
	}
65
66
	public function test_ans32() {
67
		$test = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
68
69
		$expected = '0123456789ABCDEFGHIJKLMNOPQRSTUV';
70
71
		$text = DataHelper::ans32( $test );
72
73
		$this->assertEquals( $expected, $text );
74
	}
75
76
	public function test_n() {
77
		$test = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
78
79
		$expected = '0123456789';
80
81
		$text = DataHelper::n( $test );
82
83
		$this->assertEquals( $expected, $text );
84
	}
85
}
86