@@ -13,27 +13,51 @@ final class SecurityCheckerTest extends TestCase
13
13
{
14
14
15
15
/**
16
- * @dataProvider getIsValidData
16
+ * @dataProvider getIsInvoiceSecurityValid
17
17
* @param mixed[] $invoice
18
18
*/
19
- public function testIsValid (array $ invoice , int $ time , string $ expectedSecurity )
19
+ public function testIsInvoiceSecurityValid (array $ invoice , int $ time , string $ expectedSecurity )
20
20
{
21
21
Assert::true (SecurityChecker::isValid ($ invoice , $ time , $ expectedSecurity ));
22
22
}
23
23
24
24
/**
25
- * @dataProvider getInvalidData
25
+ * @dataProvider getIsInvoiceSecurityInvalid
26
26
* @param mixed[] $invoice
27
27
*/
28
- public function testInvalid (array $ invoice , int $ time , string $ expectedSecurity )
28
+ public function testIsInvoiceSecurityInvalid (array $ invoice , int $ time , string $ expectedSecurity )
29
29
{
30
30
Assert::false (SecurityChecker::isValid ($ invoice , $ time , $ expectedSecurity ));
31
31
}
32
32
33
+ /**
34
+ * @dataProvider getIsVoucherSecurityValid
35
+ * @param mixed[] $voucher
36
+ * @param mixed[] $itemTemplate
37
+ */
38
+ public function testIsVoucherSecurityValid (array $ voucher , array $ itemTemplate , int $ time , string $ expectedSecurity )
39
+ {
40
+ Assert::true (SecurityChecker::isVoucherSecurityValid ($ voucher , $ itemTemplate , $ time , $ expectedSecurity ));
41
+ }
42
+
43
+ /**
44
+ * @dataProvider getIsVoucherSecurityInvalid
45
+ * @param mixed[] $voucher
46
+ * @param mixed[] $itemTemplate
47
+ */
48
+ public function testIsVoucherSecurityInvalid (
49
+ array $ voucher ,
50
+ array $ itemTemplate ,
51
+ int $ time ,
52
+ string $ expectedSecurity
53
+ ) {
54
+ Assert::false (SecurityChecker::isVoucherSecurityValid ($ voucher , $ itemTemplate , $ time , $ expectedSecurity ));
55
+ }
56
+
33
57
/**
34
58
* @return mixed[]
35
59
*/
36
- public function getIsValidData (): array
60
+ public function getIsInvoiceSecurityValid (): array
37
61
{
38
62
return [
39
63
[
@@ -60,7 +84,7 @@ final class SecurityCheckerTest extends TestCase
60
84
/**
61
85
* @return mixed[]
62
86
*/
63
- public function getInvalidData (): array
87
+ public function getIsInvoiceSecurityInvalid (): array
64
88
{
65
89
return [
66
90
[
@@ -85,6 +109,54 @@ final class SecurityCheckerTest extends TestCase
85
109
];
86
110
}
87
111
112
+ /**
113
+ * @return mixed[]
114
+ */
115
+ public function getIsVoucherSecurityValid (): array
116
+ {
117
+ return [
118
+ [
119
+ 'voucher ' => [
120
+ 'id ' => 102 ,
121
+ 'code ' => 'ZQSDP3 ' ,
122
+ ],
123
+ 'itemTemplate ' => [
124
+ 'id ' => 1 ,
125
+ 'code ' => 'STARTY ' ,
126
+ ],
127
+ 'time ' => 1617179013 ,
128
+ 'expectedSecurity ' => 'cf7550d28d2015944992225ae3a42752608060b7 ' ,
129
+ ],
130
+ ];
131
+ }
132
+
133
+ /**
134
+ * @return mixed[]
135
+ */
136
+ public function getIsVoucherSecurityInvalid (): array
137
+ {
138
+ return [
139
+ [
140
+ 'voucher ' => [
141
+ 'id ' => 1 ,
142
+ 'code ' => "ABCD " ,
143
+ ],
144
+ 'itemTemplate ' => [
145
+ 'id ' => 1 ,
146
+ 'code ' => 'test ' ,
147
+ ],
148
+ 'time ' => 1542298656 ,
149
+ 'expectedSecurity ' => '35221e0d0168d282edc3768ed4b4e878dec3c921 ' ,
150
+ ],
151
+ [
152
+ 'voucher ' => [],
153
+ 'itemTemplate ' => [],
154
+ 'time ' => 1542298656 ,
155
+ 'expectedSecurity ' => '35221e0d0168d282edc3768ed4b4e878dec3c921 ' ,
156
+ ],
157
+ ];
158
+ }
159
+
88
160
}
89
161
90
162
(new SecurityCheckerTest ())->run ();
0 commit comments