@@ -39,92 +39,92 @@ discard block |
||
39 | 39 | * Array of all avaialable odd characters. |
40 | 40 | */ |
41 | 41 | private $odd = array( |
42 | - '0' => 1, |
|
43 | - '1' => 0, |
|
44 | - '2' => 5, |
|
45 | - '3' => 7, |
|
46 | - '4' => 9, |
|
47 | - '5' => 13, |
|
48 | - '6' => 15, |
|
49 | - '7' => 17, |
|
50 | - '8' => 19, |
|
51 | - '9' => 21, |
|
52 | - 'A' => 1, |
|
53 | - 'B' => 0, |
|
54 | - 'C' => 5, |
|
55 | - 'D' => 7, |
|
56 | - 'E' => 9, |
|
57 | - 'F' => 13, |
|
58 | - 'G' => 15, |
|
59 | - 'H' => 17, |
|
60 | - 'I' => 19, |
|
61 | - 'J' => 21, |
|
62 | - 'K' => 2, |
|
63 | - 'L' => 4, |
|
64 | - 'M' => 18, |
|
65 | - 'N' => 20, |
|
66 | - 'O' => 11, |
|
67 | - 'P' => 3, |
|
68 | - 'Q' => 6, |
|
69 | - 'R' => 8, |
|
70 | - 'S' => 12, |
|
71 | - 'T' => 14, |
|
72 | - 'U' => 16, |
|
73 | - 'V' => 10, |
|
74 | - 'W' => 22, |
|
75 | - 'X' => 25, |
|
76 | - 'Y' => 24, |
|
77 | - 'Z' => 23 |
|
78 | - ); |
|
42 | + '0' => 1, |
|
43 | + '1' => 0, |
|
44 | + '2' => 5, |
|
45 | + '3' => 7, |
|
46 | + '4' => 9, |
|
47 | + '5' => 13, |
|
48 | + '6' => 15, |
|
49 | + '7' => 17, |
|
50 | + '8' => 19, |
|
51 | + '9' => 21, |
|
52 | + 'A' => 1, |
|
53 | + 'B' => 0, |
|
54 | + 'C' => 5, |
|
55 | + 'D' => 7, |
|
56 | + 'E' => 9, |
|
57 | + 'F' => 13, |
|
58 | + 'G' => 15, |
|
59 | + 'H' => 17, |
|
60 | + 'I' => 19, |
|
61 | + 'J' => 21, |
|
62 | + 'K' => 2, |
|
63 | + 'L' => 4, |
|
64 | + 'M' => 18, |
|
65 | + 'N' => 20, |
|
66 | + 'O' => 11, |
|
67 | + 'P' => 3, |
|
68 | + 'Q' => 6, |
|
69 | + 'R' => 8, |
|
70 | + 'S' => 12, |
|
71 | + 'T' => 14, |
|
72 | + 'U' => 16, |
|
73 | + 'V' => 10, |
|
74 | + 'W' => 22, |
|
75 | + 'X' => 25, |
|
76 | + 'Y' => 24, |
|
77 | + 'Z' => 23 |
|
78 | + ); |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Array of all avaialable even characters. |
82 | 82 | */ |
83 | - private $even = array( |
|
84 | - '0' => 0, |
|
85 | - '1' => 1, |
|
86 | - '2' => 2, |
|
87 | - '3' => 3, |
|
88 | - '4' => 4, |
|
89 | - '5' => 5, |
|
90 | - '6' => 6, |
|
91 | - '7' => 7, |
|
92 | - '8' => 8, |
|
93 | - '9' => 9, |
|
94 | - 'A' => 0, |
|
95 | - 'B' => 1, |
|
96 | - 'C' => 2, |
|
97 | - 'D' => 3, |
|
98 | - 'E' => 4, |
|
99 | - 'F' => 5, |
|
100 | - 'G' => 6, |
|
101 | - 'H' => 7, |
|
102 | - 'I' => 8, |
|
103 | - 'J' => 9, |
|
104 | - 'K' => 10, |
|
105 | - 'L' => 11, |
|
106 | - 'M' => 12, |
|
107 | - 'N' => 13, |
|
108 | - 'O' => 14, |
|
109 | - 'P' => 15, |
|
110 | - 'Q' => 16, |
|
111 | - 'R' => 17, |
|
112 | - 'S' => 18, |
|
113 | - 'T' => 19, |
|
114 | - 'U' => 20, |
|
115 | - 'V' => 21, |
|
116 | - 'W' => 22, |
|
117 | - 'X' => 23, |
|
118 | - 'Y' => 24, |
|
119 | - 'Z' => 25 |
|
120 | - ); |
|
83 | + private $even = array( |
|
84 | + '0' => 0, |
|
85 | + '1' => 1, |
|
86 | + '2' => 2, |
|
87 | + '3' => 3, |
|
88 | + '4' => 4, |
|
89 | + '5' => 5, |
|
90 | + '6' => 6, |
|
91 | + '7' => 7, |
|
92 | + '8' => 8, |
|
93 | + '9' => 9, |
|
94 | + 'A' => 0, |
|
95 | + 'B' => 1, |
|
96 | + 'C' => 2, |
|
97 | + 'D' => 3, |
|
98 | + 'E' => 4, |
|
99 | + 'F' => 5, |
|
100 | + 'G' => 6, |
|
101 | + 'H' => 7, |
|
102 | + 'I' => 8, |
|
103 | + 'J' => 9, |
|
104 | + 'K' => 10, |
|
105 | + 'L' => 11, |
|
106 | + 'M' => 12, |
|
107 | + 'N' => 13, |
|
108 | + 'O' => 14, |
|
109 | + 'P' => 15, |
|
110 | + 'Q' => 16, |
|
111 | + 'R' => 17, |
|
112 | + 'S' => 18, |
|
113 | + 'T' => 19, |
|
114 | + 'U' => 20, |
|
115 | + 'V' => 21, |
|
116 | + 'W' => 22, |
|
117 | + 'X' => 23, |
|
118 | + 'Y' => 24, |
|
119 | + 'Z' => 25 |
|
120 | + ); |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Array of all avaialable omocodia characters. |
124 | 124 | */ |
125 | - private $omocodiaCodes = array( |
|
126 | - '0' => 'L', |
|
127 | - '1' => 'M', |
|
125 | + private $omocodiaCodes = array( |
|
126 | + '0' => 'L', |
|
127 | + '1' => 'M', |
|
128 | 128 | '2' => 'N', |
129 | 129 | '3' => 'P', |
130 | 130 | '4' => 'Q', |
@@ -133,20 +133,20 @@ discard block |
||
133 | 133 | '7' => 'T', |
134 | 134 | '8' => 'U', |
135 | 135 | '9' => 'V' |
136 | - ); |
|
136 | + ); |
|
137 | 137 | |
138 | - /** |
|
139 | - * Create a Codice Fiscale instance. |
|
140 | - * @param Subject $subject The subject that will have the codice fiscale. |
|
138 | + /** |
|
139 | + * Create a Codice Fiscale instance. |
|
140 | + * @param Subject $subject The subject that will have the codice fiscale. |
|
141 | 141 | * @param $properties An array with additional properties. |
142 | - */ |
|
143 | - public function __construct(Subject $subject, $properties = array()){ |
|
142 | + */ |
|
143 | + public function __construct(Subject $subject, $properties = array()){ |
|
144 | 144 | $this->subject = $subject; |
145 | 145 | |
146 | 146 | if (array_key_exists('omocodiaLevel', $properties)) { |
147 | 147 | $this->omocodiaLevel = $properties['omocodiaLevel']; |
148 | 148 | } |
149 | - } |
|
149 | + } |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Calculate the code fiscale. |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function calculate(){ |
156 | 156 | $temporaryCodiceFiscale = $this->calculateSurname() . $this->calculateName() . |
157 | - $this->calculateBirthDateAndGender() . $this->calculateBelfioreCode(); |
|
157 | + $this->calculateBirthDateAndGender() . $this->calculateBelfioreCode(); |
|
158 | 158 | $temporaryCodiceFiscale = $this->calculateOmocodia($temporaryCodiceFiscale); |
159 | 159 | return $temporaryCodiceFiscale . $this->calculateCheckDigit($temporaryCodiceFiscale); |
160 | 160 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $result = substr($consonants, 0, 3); |
184 | 184 | } else { |
185 | 185 | $vowels = str_replace(str_split($consonants), '', $this->subject->getSurname()); |
186 | - $result = substr($consonants . $vowels . 'XXX', 0, 3); |
|
186 | + $result = substr($consonants . $vowels . 'XXX', 0, 3); |
|
187 | 187 | } |
188 | 188 | return $result; |
189 | 189 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $result = join($consonants); |
201 | 201 | } else{ |
202 | 202 | $vowels = str_replace(str_split($consonants), '', $this->subject->getName()); |
203 | - $result = substr($consonants . $vowels . 'XXX', 0, 3); |
|
203 | + $result = substr($consonants . $vowels . 'XXX', 0, 3); |
|
204 | 204 | } |
205 | 205 | return $result; |
206 | 206 | } |
@@ -234,20 +234,20 @@ discard block |
||
234 | 234 | */ |
235 | 235 | private function calculateCheckDigit($temporaryCodiceFiscale){ |
236 | 236 | $sumEven = 0; |
237 | - $sumOdd = 0; |
|
238 | - for ($i = 0; $i < 15; $i = $i + 2) |
|
239 | - { |
|
240 | - $k = $temporaryCodiceFiscale{$i}; |
|
241 | - $sumOdd = $sumOdd + $this->odd[$k]; |
|
242 | - } |
|
237 | + $sumOdd = 0; |
|
238 | + for ($i = 0; $i < 15; $i = $i + 2) |
|
239 | + { |
|
240 | + $k = $temporaryCodiceFiscale{$i}; |
|
241 | + $sumOdd = $sumOdd + $this->odd[$k]; |
|
242 | + } |
|
243 | 243 | |
244 | - for ($i = 1; $i < 15; $i = $i + 2) |
|
245 | - { |
|
246 | - $k = $temporaryCodiceFiscale{$i}; |
|
247 | - $sumEven = $sumEven + $this->even[$k]; |
|
248 | - } |
|
244 | + for ($i = 1; $i < 15; $i = $i + 2) |
|
245 | + { |
|
246 | + $k = $temporaryCodiceFiscale{$i}; |
|
247 | + $sumEven = $sumEven + $this->even[$k]; |
|
248 | + } |
|
249 | 249 | |
250 | - return chr(($sumOdd + $sumEven) % 26 + 65); |
|
250 | + return chr(($sumOdd + $sumEven) % 26 + 65); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | */ |
19 | 19 | const ALL_OMOCODIA_LEVELS = -1; |
20 | 20 | |
21 | - /** |
|
22 | - * Create a Codice Fiscale instance. |
|
23 | - * @param Subject $subject The subject. |
|
21 | + /** |
|
22 | + * Create a Codice Fiscale instance. |
|
23 | + * @param Subject $subject The subject. |
|
24 | 24 | * @param $properties Array of additional properties. |
25 | - */ |
|
26 | - public function __construct(Subject $subject, $properties = array()){ |
|
27 | - $this->subject = $subject; |
|
25 | + */ |
|
26 | + public function __construct(Subject $subject, $properties = array()){ |
|
27 | + $this->subject = $subject; |
|
28 | 28 | |
29 | 29 | if (array_key_exists('codiceFiscaleToCheck', $properties)) { |
30 | 30 | $this->codiceFiscaleToCheck = $properties['codiceFiscaleToCheck']; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | if (array_key_exists('omocodiaLevel', $properties)) { |
34 | 34 | $this->omocodiaLevel = $properties['omocodiaLevel']; |
35 | 35 | } |
36 | - } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Check if the given data is ok for the given codice fiscale. |
@@ -15,18 +15,18 @@ discard block |
||
15 | 15 | private $gender; |
16 | 16 | private $belfioreCode; |
17 | 17 | |
18 | - /** |
|
19 | - * Create a Codice Fiscale instance. |
|
20 | - * @param array $properties An array with all the properties. |
|
21 | - * Supported keys are: |
|
22 | - * - name: the name; |
|
23 | - * - surname: the surname; |
|
18 | + /** |
|
19 | + * Create a Codice Fiscale instance. |
|
20 | + * @param array $properties An array with all the properties. |
|
21 | + * Supported keys are: |
|
22 | + * - name: the name; |
|
23 | + * - surname: the surname; |
|
24 | 24 | * - birthDate: the birth date; |
25 | 25 | * - gender: the gender; |
26 | 26 | * - belfioreCode: the Belfiore code. |
27 | - */ |
|
28 | - public function __construct($properties){ |
|
29 | - //Set properties |
|
27 | + */ |
|
28 | + public function __construct($properties){ |
|
29 | + //Set properties |
|
30 | 30 | if (array_key_exists('name', $properties)) { |
31 | 31 | $this->name = strtoupper($properties['name']); |
32 | 32 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | if (array_key_exists('belfioreCode', $properties)) { |
50 | 50 | $this->belfioreCode = $properties['belfioreCode']; |
51 | 51 | } |
52 | - } |
|
52 | + } |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Get the name. |
@@ -9,188 +9,188 @@ discard block |
||
9 | 9 | class CalculatorTest extends \PHPUnit_Framework_TestCase { |
10 | 10 | |
11 | 11 | /** |
12 | - * Test for calculate. |
|
12 | + * Test for calculate. |
|
13 | 13 | * @dataProvider calculateProvider |
14 | - */ |
|
15 | - public function testCalculate($subject, $omocodiaLevel, $expectedCodiceFiscale){ |
|
16 | - $calculator = new Calculator($subject, array( |
|
14 | + */ |
|
15 | + public function testCalculate($subject, $omocodiaLevel, $expectedCodiceFiscale){ |
|
16 | + $calculator = new Calculator($subject, array( |
|
17 | 17 | "omocodiaLevel" => $omocodiaLevel |
18 | 18 | )); |
19 | - $actual = $calculator->calculate(); |
|
20 | - $this->assertEquals($expectedCodiceFiscale, $actual); |
|
21 | - } |
|
19 | + $actual = $calculator->calculate(); |
|
20 | + $this->assertEquals($expectedCodiceFiscale, $actual); |
|
21 | + } |
|
22 | 22 | |
23 | 23 | /** |
24 | - * Test for calculateAllPossibilities. |
|
24 | + * Test for calculateAllPossibilities. |
|
25 | 25 | * @dataProvider calculateAllPossibilitiesProvider |
26 | - */ |
|
27 | - public function testCalculateAllPossibilities($subject, $expected){ |
|
26 | + */ |
|
27 | + public function testCalculateAllPossibilities($subject, $expected){ |
|
28 | 28 | $calculator = new Calculator($subject); |
29 | 29 | $actual = $calculator->calculateAllPossibilities(); |
30 | - $this->assertEquals($expected, $actual); |
|
31 | - } |
|
30 | + $this->assertEquals($expected, $actual); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * The calculate data provider. |
35 | 35 | */ |
36 | 36 | public function calculateProvider(){ |
37 | 37 | return array( |
38 | - array( |
|
38 | + array( |
|
39 | 39 | new Subject( |
40 | - array( |
|
40 | + array( |
|
41 | 41 | "name" => "Mario", |
42 | 42 | "surname" => "Rossi", |
43 | 43 | "birthDate" => "1985-12-10", |
44 | 44 | "gender" => "M", |
45 | 45 | "belfioreCode" => "A562" |
46 | - ) |
|
46 | + ) |
|
47 | 47 | ), |
48 | 48 | 0, |
49 | 49 | "RSSMRA85T10A562S" |
50 | - ), |
|
51 | - array( |
|
50 | + ), |
|
51 | + array( |
|
52 | 52 | new Subject( |
53 | - array( |
|
53 | + array( |
|
54 | 54 | "name" => "Roberto", |
55 | 55 | "surname" => "Santini", |
56 | 56 | "birthDate" => "1963-05-08", |
57 | 57 | "gender" => "M", |
58 | 58 | "belfioreCode" => "H501" |
59 | - ) |
|
59 | + ) |
|
60 | 60 | ), |
61 | 61 | 0, |
62 | 62 | "SNTRRT63E08H501T" |
63 | - ), |
|
64 | - array( |
|
63 | + ), |
|
64 | + array( |
|
65 | 65 | new Subject( |
66 | - array( |
|
66 | + array( |
|
67 | 67 | "name" => "Maria", |
68 | 68 | "surname" => "Montessori", |
69 | 69 | "birthDate" => "1870-08-31", |
70 | 70 | "gender" => "F", |
71 | 71 | "belfioreCode" => "C615" |
72 | - ) |
|
72 | + ) |
|
73 | 73 | ), |
74 | 74 | 0, |
75 | 75 | "MNTMRA70M71C615I" |
76 | - ), |
|
77 | - array( |
|
76 | + ), |
|
77 | + array( |
|
78 | 78 | new Subject( |
79 | - array( |
|
79 | + array( |
|
80 | 80 | "name" => "Mario", |
81 | 81 | "surname" => "Rossi", |
82 | 82 | "birthDate" => new \DateTime('1985-12-10'), |
83 | 83 | "gender" => "M", |
84 | 84 | "belfioreCode" => "A562" |
85 | - ) |
|
85 | + ) |
|
86 | 86 | ), |
87 | 87 | 0, |
88 | 88 | "RSSMRA85T10A562S" |
89 | - ), |
|
90 | - array( |
|
89 | + ), |
|
90 | + array( |
|
91 | 91 | new Subject( |
92 | - array( |
|
92 | + array( |
|
93 | 93 | "name" => "Gianfranco", |
94 | 94 | "surname" => "Rossi", |
95 | 95 | "birthDate" => "1985-12-10", |
96 | 96 | "gender" => "M", |
97 | 97 | "belfioreCode" => "A562" |
98 | - ) |
|
98 | + ) |
|
99 | 99 | ), |
100 | 100 | 0, |
101 | 101 | "RSSGFR85T10A562I" |
102 | - ), |
|
103 | - array( |
|
102 | + ), |
|
103 | + array( |
|
104 | 104 | new Subject( |
105 | - array( |
|
105 | + array( |
|
106 | 106 | "name" => "Mario", |
107 | 107 | "surname" => "Fo", |
108 | 108 | "birthDate" => "1985-12-10", |
109 | 109 | "gender" => "M", |
110 | 110 | "belfioreCode" => "A562" |
111 | - ) |
|
111 | + ) |
|
112 | 112 | ), |
113 | 113 | 0, |
114 | 114 | "FOXMRA85T10A562G" |
115 | - ), |
|
116 | - array( |
|
115 | + ), |
|
116 | + array( |
|
117 | 117 | new Subject( |
118 | - array( |
|
118 | + array( |
|
119 | 119 | "name" => "", |
120 | 120 | "surname" => "Rossi", |
121 | 121 | "birthDate" => "1985-12-10", |
122 | 122 | "gender" => "M", |
123 | 123 | "belfioreCode" => "A562" |
124 | - ) |
|
124 | + ) |
|
125 | 125 | ), |
126 | 126 | 0, |
127 | 127 | "RSSXXX85T10A562R" |
128 | - ), |
|
129 | - array( |
|
128 | + ), |
|
129 | + array( |
|
130 | 130 | new Subject( |
131 | - array( |
|
131 | + array( |
|
132 | 132 | "name" => "Mario", |
133 | 133 | "surname" => "", |
134 | 134 | "birthDate" => "1985-12-10", |
135 | 135 | "gender" => "M", |
136 | 136 | "belfioreCode" => "A562" |
137 | - ) |
|
137 | + ) |
|
138 | 138 | ), |
139 | 139 | 0, |
140 | 140 | "XXXMRA85T10A562B" |
141 | - ), |
|
142 | - array( |
|
141 | + ), |
|
142 | + array( |
|
143 | 143 | new Subject( |
144 | - array( |
|
144 | + array( |
|
145 | 145 | "name" => "", |
146 | 146 | "surname" => "", |
147 | 147 | "birthDate" => "1985-12-10", |
148 | 148 | "gender" => "M", |
149 | 149 | "belfioreCode" => "A562" |
150 | - ) |
|
150 | + ) |
|
151 | 151 | ), |
152 | 152 | 0, |
153 | 153 | "XXXXXX85T10A562A" |
154 | - ), |
|
155 | - array( |
|
154 | + ), |
|
155 | + array( |
|
156 | 156 | new Subject( |
157 | - array( |
|
157 | + array( |
|
158 | 158 | "name" => "Roberto", |
159 | 159 | "surname" => "Santi", |
160 | 160 | "birthDate" => "1963-05-08", |
161 | 161 | "gender" => "M", |
162 | 162 | "belfioreCode" => "H501" |
163 | - ) |
|
163 | + ) |
|
164 | 164 | ), |
165 | 165 | 1, |
166 | 166 | "SNTRRT63E08H50ML" |
167 | - ), |
|
168 | - array( |
|
167 | + ), |
|
168 | + array( |
|
169 | 169 | new Subject( |
170 | - array( |
|
170 | + array( |
|
171 | 171 | "name" => "Mario", |
172 | 172 | "surname" => "Rossi", |
173 | 173 | "birthDate" => "1985-12-10", |
174 | 174 | "gender" => "M", |
175 | 175 | "belfioreCode" => "A562" |
176 | - ) |
|
176 | + ) |
|
177 | 177 | ), |
178 | 178 | 1, |
179 | 179 | "RSSMRA85T10A56NH" |
180 | - ), |
|
181 | - array( |
|
180 | + ), |
|
181 | + array( |
|
182 | 182 | new Subject( |
183 | - array( |
|
183 | + array( |
|
184 | 184 | "name" => "Mario", |
185 | 185 | "surname" => "Rossi", |
186 | 186 | "birthDate" => "1985-12-10", |
187 | 187 | "gender" => "M", |
188 | 188 | "belfioreCode" => "A562" |
189 | - ) |
|
189 | + ) |
|
190 | 190 | ), |
191 | 191 | 3, |
192 | 192 | "RSSMRA85T10ARSNO" |
193 | - ) |
|
193 | + ) |
|
194 | 194 | ); |
195 | 195 | } |
196 | 196 | |
@@ -199,48 +199,48 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public function calculateAllPossibilitiesProvider(){ |
201 | 201 | return array( |
202 | - array( |
|
202 | + array( |
|
203 | 203 | new Subject( |
204 | - array( |
|
204 | + array( |
|
205 | 205 | "name" => "Mario", |
206 | 206 | "surname" => "Rossi", |
207 | 207 | "birthDate" => "1985-12-10", |
208 | 208 | "gender" => "M", |
209 | 209 | "belfioreCode" => "A562" |
210 | - ) |
|
210 | + ) |
|
211 | 211 | ), |
212 | 212 | array( |
213 | - "RSSMRA85T10A562S", |
|
214 | - "RSSMRA85T10A56NH", |
|
215 | - "RSSMRA85T10A5SNT", |
|
216 | - "RSSMRA85T10ARSNO", |
|
217 | - "RSSMRA85T1LARSNR", |
|
218 | - "RSSMRA85TMLARSNC", |
|
219 | - "RSSMRA8RTMLARSNO", |
|
220 | - "RSSMRAURTMLARSNL" |
|
213 | + "RSSMRA85T10A562S", |
|
214 | + "RSSMRA85T10A56NH", |
|
215 | + "RSSMRA85T10A5SNT", |
|
216 | + "RSSMRA85T10ARSNO", |
|
217 | + "RSSMRA85T1LARSNR", |
|
218 | + "RSSMRA85TMLARSNC", |
|
219 | + "RSSMRA8RTMLARSNO", |
|
220 | + "RSSMRAURTMLARSNL" |
|
221 | 221 | ) |
222 | - ), |
|
223 | - array( |
|
222 | + ), |
|
223 | + array( |
|
224 | 224 | new Subject( |
225 | - array( |
|
225 | + array( |
|
226 | 226 | "name" => "Roberto", |
227 | 227 | "surname" => "Santi", |
228 | 228 | "birthDate" => "1963-05-08", |
229 | 229 | "gender" => "M", |
230 | 230 | "belfioreCode" => "H501" |
231 | - ) |
|
231 | + ) |
|
232 | 232 | ), |
233 | 233 | array( |
234 | - "SNTRRT63E08H501T", |
|
235 | - "SNTRRT63E08H50ML", |
|
236 | - "SNTRRT63E08H5LMW", |
|
237 | - "SNTRRT63E08HRLMR", |
|
238 | - "SNTRRT63E0UHRLMO", |
|
239 | - "SNTRRT63ELUHRLMZ", |
|
240 | - "SNTRRT6PELUHRLML", |
|
241 | - "SNTRRTSPELUHRLMI" |
|
234 | + "SNTRRT63E08H501T", |
|
235 | + "SNTRRT63E08H50ML", |
|
236 | + "SNTRRT63E08H5LMW", |
|
237 | + "SNTRRT63E08HRLMR", |
|
238 | + "SNTRRT63E0UHRLMO", |
|
239 | + "SNTRRT63ELUHRLMZ", |
|
240 | + "SNTRRT6PELUHRLML", |
|
241 | + "SNTRRTSPELUHRLMI" |
|
242 | + ) |
|
242 | 243 | ) |
243 | - ) |
|
244 | 244 | ); |
245 | 245 | } |
246 | 246 | } |
@@ -9,65 +9,65 @@ |
||
9 | 9 | class CheckerTest extends \PHPUnit_Framework_TestCase { |
10 | 10 | |
11 | 11 | /** |
12 | - * Test for check. |
|
12 | + * Test for check. |
|
13 | 13 | * @dataProvider checkerProvider |
14 | - */ |
|
15 | - public function testAllLevels($subject, $codiceFiscaleToCheck, $omocodiaLevel, $expected){ |
|
14 | + */ |
|
15 | + public function testAllLevels($subject, $codiceFiscaleToCheck, $omocodiaLevel, $expected){ |
|
16 | 16 | $checker = new Checker($subject, array( |
17 | 17 | "codiceFiscaleToCheck" => $codiceFiscaleToCheck, |
18 | 18 | "omocodiaLevel" => $omocodiaLevel |
19 | 19 | )); |
20 | - $actual = $checker->check(); |
|
21 | - $this->assertEquals($expected, $actual); |
|
22 | - } |
|
20 | + $actual = $checker->check(); |
|
21 | + $this->assertEquals($expected, $actual); |
|
22 | + } |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * The checker provider. |
26 | 26 | */ |
27 | 27 | public function checkerProvider(){ |
28 | 28 | return array( |
29 | - array( |
|
29 | + array( |
|
30 | 30 | new Subject( |
31 | - array( |
|
31 | + array( |
|
32 | 32 | "name" => "Mario", |
33 | 33 | "surname" => "Rossi", |
34 | 34 | "birthDate" => "1985-12-10", |
35 | 35 | "gender" => "M", |
36 | 36 | "belfioreCode" => "A562" |
37 | - ) |
|
37 | + ) |
|
38 | 38 | ), |
39 | 39 | "RSSMRA85T10A562S", |
40 | 40 | 0, |
41 | 41 | true |
42 | - ), |
|
43 | - array( |
|
42 | + ), |
|
43 | + array( |
|
44 | 44 | new Subject( |
45 | - array( |
|
45 | + array( |
|
46 | 46 | "name" => "Mario", |
47 | 47 | "surname" => "Rossi", |
48 | 48 | "birthDate" => "1985-12-10", |
49 | 49 | "gender" => "M", |
50 | 50 | "belfioreCode" => "A562" |
51 | - ) |
|
51 | + ) |
|
52 | 52 | ), |
53 | 53 | "RSSMRA85T10A562S", |
54 | 54 | 2, |
55 | 55 | false |
56 | - ), |
|
57 | - array( |
|
56 | + ), |
|
57 | + array( |
|
58 | 58 | new Subject( |
59 | - array( |
|
59 | + array( |
|
60 | 60 | "name" => "Roberto", |
61 | 61 | "surname" => "Santi", |
62 | 62 | "birthDate" => "1963-05-08", |
63 | 63 | "gender" => "M", |
64 | 64 | "belfioreCode" => "H501" |
65 | - ) |
|
65 | + ) |
|
66 | 66 | ), |
67 | 67 | "SNTRRT63E08H50ML", |
68 | 68 | Checker::ALL_OMOCODIA_LEVELS, |
69 | 69 | true |
70 | - ) |
|
70 | + ) |
|
71 | 71 | ); |
72 | 72 | } |
73 | 73 | } |