|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\IDealBasic; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Title: iDEAL Basic data helper tests |
|
7
|
|
|
* Description: |
|
8
|
|
|
* Copyright: 2005-2019 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
|
|
|
|