Oefenweb /
cakephp-edexml
| 1 | <?php |
||
| 2 | App::uses('Edexml', 'Edexml.Model'); |
||
| 3 | |||
| 4 | class TestEdexml extends Edexml { |
||
| 5 | |||
| 6 | public function schoolClasses($schoolClasses) { |
||
| 7 | $this->_schoolClasses = $schoolClasses; |
||
| 8 | } |
||
| 9 | |||
| 10 | /** |
||
| 11 | * Test double of `parent::_convertKey`. |
||
| 12 | * |
||
| 13 | */ |
||
| 14 | public function convertKey($key) { |
||
| 15 | return $this->_convertKey($key); |
||
| 16 | } |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Test double of `parent::_convertNames`. |
||
| 20 | * |
||
| 21 | */ |
||
| 22 | public function convertNames($user) { |
||
| 23 | return $this->_convertNames($user); |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Test double of `parent::_convertSchool`. |
||
| 28 | * |
||
| 29 | */ |
||
| 30 | public function convertSchool($school) { |
||
| 31 | return $this->_convertSchool($school); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Test double of `parent::_convertSchoolClass`. |
||
| 36 | * |
||
| 37 | */ |
||
| 38 | public function convertSchoolClass($schoolClass) { |
||
| 39 | return $this->_convertSchoolClass($schoolClass); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Test double of `parent::_convertSchoolClasses`. |
||
| 44 | * |
||
| 45 | */ |
||
| 46 | public function convertSchoolClasses($schoolClasses) { |
||
| 47 | return $this->_convertSchoolClasses($schoolClasses); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Test double of `parent::_convertStudent`. |
||
| 52 | * |
||
| 53 | */ |
||
| 54 | public function convertStudent($data) { |
||
| 55 | return $this->_convertStudent($data); |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Test double of `parent::_convertTeacher`. |
||
| 60 | * |
||
| 61 | */ |
||
| 62 | public function convertTeacher($data) { |
||
| 63 | return $this->_convertTeacher($data); |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Test double of `parent::_parse`. |
||
| 68 | * |
||
| 69 | */ |
||
| 70 | public function parse($filename) { |
||
| 71 | return $this->_parse($filename); |
||
| 72 | } |
||
| 73 | |||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Edexml Test. |
||
| 78 | * |
||
| 79 | * @property TestEdexml $Edexml |
||
| 80 | */ |
||
| 81 | class EdexmlTest extends CakeTestCase { |
||
|
0 ignored issues
–
show
|
|||
| 82 | |||
| 83 | /** |
||
| 84 | * Fixtures. |
||
| 85 | * |
||
| 86 | * @var array |
||
| 87 | */ |
||
| 88 | public $fixtures = []; |
||
| 89 | |||
| 90 | /** |
||
| 91 | * setUp method. |
||
| 92 | * |
||
| 93 | * @return void |
||
| 94 | */ |
||
| 95 | public function setUp() { |
||
| 96 | parent::setUp(); |
||
| 97 | |||
| 98 | $this->Edexml = ClassRegistry::init('TestEdexml', true); |
||
|
0 ignored issues
–
show
The type
ClassRegistry was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 99 | } |
||
| 100 | |||
| 101 | /** |
||
| 102 | * tearDown method. |
||
| 103 | * |
||
| 104 | * @return void |
||
| 105 | */ |
||
| 106 | public function tearDown() { |
||
| 107 | unset($this->Edexml); |
||
| 108 | |||
| 109 | parent::tearDown(); |
||
| 110 | } |
||
| 111 | |||
| 112 | /** |
||
| 113 | * Tests `convertKey`. |
||
| 114 | * |
||
| 115 | * @return void |
||
| 116 | */ |
||
| 117 | public function testConvertKey() { |
||
| 118 | $this->assertNull($this->Edexml->convertKey('#001')); |
||
| 119 | $this->assertEquals('1', $this->Edexml->convertKey('1')); |
||
| 120 | $this->assertEquals('key', $this->Edexml->convertKey('key')); |
||
| 121 | } |
||
| 122 | |||
| 123 | /** |
||
| 124 | * Tests `convertNames`. |
||
| 125 | * |
||
| 126 | * @return void |
||
| 127 | */ |
||
| 128 | public function testConvertNames() { |
||
| 129 | $data = [ |
||
| 130 | 'achternaam' => 'Achternaam', |
||
| 131 | 'roepnaam' => 'Roepnaam' |
||
| 132 | ]; |
||
| 133 | $expected = [ |
||
| 134 | 'last_name' => $data['achternaam'], |
||
| 135 | 'first_name' => $data['roepnaam'], |
||
| 136 | ]; |
||
| 137 | $this->assertEquals($expected, $this->Edexml->convertNames($data)); |
||
| 138 | |||
| 139 | $data = [ |
||
| 140 | 'achternaam' => 'Achternaam', |
||
| 141 | 'voorvoegsel' => 'Voorvoegsel', |
||
| 142 | 'roepnaam' => 'Roepnaam' |
||
| 143 | ]; |
||
| 144 | $expected = [ |
||
| 145 | 'last_name' => $data['voorvoegsel'] . ' ' . $data['achternaam'], |
||
| 146 | 'first_name' => $data['roepnaam'], |
||
| 147 | ]; |
||
| 148 | $this->assertEquals($expected, $this->Edexml->convertNames($data)); |
||
| 149 | } |
||
| 150 | |||
| 151 | /** |
||
| 152 | * Tests `convertSchool`. |
||
| 153 | * |
||
| 154 | * @return void |
||
| 155 | */ |
||
| 156 | public function testConvertSchool() { |
||
| 157 | $data = [ |
||
| 158 | 'schoolkey' => 'schoolkey', |
||
| 159 | ]; |
||
| 160 | $expected = [ |
||
| 161 | 'key' => $data['schoolkey'] |
||
| 162 | ]; |
||
| 163 | $this->assertEquals($expected, $this->Edexml->convertSchool($data)); |
||
| 164 | |||
| 165 | $data = [ |
||
| 166 | 'schoolkey' => '#001', |
||
| 167 | ]; |
||
| 168 | $expected = [ |
||
| 169 | 'key' => null |
||
| 170 | ]; |
||
| 171 | $this->assertEquals($expected, $this->Edexml->convertSchool($data)); |
||
| 172 | |||
| 173 | $data = []; |
||
| 174 | $expected = [ |
||
| 175 | 'key' => null |
||
| 176 | ]; |
||
| 177 | $this->assertEquals($expected, $this->Edexml->convertSchool($data)); |
||
| 178 | } |
||
| 179 | |||
| 180 | /** |
||
| 181 | * Tests `convertSchoolClass`. |
||
| 182 | * |
||
| 183 | * @return void |
||
| 184 | */ |
||
| 185 | public function testConvertSchoolClass() { |
||
| 186 | $data = [ |
||
| 187 | '@key' => 'key', |
||
| 188 | 'naam' => 'naam', |
||
| 189 | 'jaargroep' => '0' |
||
| 190 | ]; |
||
| 191 | $expected = [ |
||
| 192 | 'key' => $data['@key'], |
||
| 193 | 'name' => 'naam', |
||
| 194 | 'grade' => '1' |
||
| 195 | ]; |
||
| 196 | $this->assertEquals($expected, $this->Edexml->convertSchoolClass($data)); |
||
| 197 | } |
||
| 198 | |||
| 199 | /** |
||
| 200 | * Tests `convertSchoolClass`. |
||
| 201 | * |
||
| 202 | * Yeargroup S. |
||
| 203 | * |
||
| 204 | * @return void |
||
| 205 | */ |
||
| 206 | public function testConvertSchoolClassYeargroupS() { |
||
| 207 | $data = [ |
||
| 208 | '@key' => 'key', |
||
| 209 | 'naam' => 'naam', |
||
| 210 | 'jaargroep' => 'S' |
||
| 211 | ]; |
||
| 212 | $expected = [ |
||
| 213 | 'key' => $data['@key'], |
||
| 214 | 'name' => 'naam', |
||
| 215 | 'grade' => '19' |
||
| 216 | ]; |
||
| 217 | $this->assertEquals($expected, $this->Edexml->convertSchoolClass($data)); |
||
| 218 | } |
||
| 219 | |||
| 220 | /** |
||
| 221 | * Tests `convertSchoolClasses`. |
||
| 222 | * |
||
| 223 | * @return void |
||
| 224 | */ |
||
| 225 | public function testConvertSchoolClasses() { |
||
| 226 | $data = [ |
||
| 227 | 0 => [ |
||
| 228 | '@key' => 'key', |
||
| 229 | 'naam' => 'naam', |
||
| 230 | 'jaargroep' => '0' |
||
| 231 | ] |
||
| 232 | ]; |
||
| 233 | $expected = [ |
||
| 234 | 'key' => [ |
||
| 235 | 'key' => 'key', |
||
| 236 | 'name' => 'naam', |
||
| 237 | 'grade' => '1' |
||
| 238 | ] |
||
| 239 | ]; |
||
| 240 | $this->assertEquals($expected, $this->Edexml->convertSchoolClasses($data)); |
||
| 241 | } |
||
| 242 | |||
| 243 | /** |
||
| 244 | * Tests `convertStudent`. |
||
| 245 | * |
||
| 246 | * @return void |
||
| 247 | */ |
||
| 248 | public function testConvertStudent() { |
||
| 249 | $data = [ |
||
| 250 | '@key' => 'key', |
||
| 251 | 'achternaam' => 'Achternaam', |
||
| 252 | 'roepnaam' => 'Roepnaam', |
||
| 253 | 'geboortedatum' => '2005-07-19', |
||
| 254 | 'geslacht' => '0' |
||
| 255 | ]; |
||
| 256 | $expected = [ |
||
| 257 | 'key' => 'key', |
||
| 258 | 'last_name' => 'Achternaam', |
||
| 259 | 'first_name' => 'Roepnaam', |
||
| 260 | 'date_of_birth' => '2005-07-19', |
||
| 261 | 'gender' => null, |
||
| 262 | 'grade' => null, |
||
| 263 | 'SchoolClass' => [] |
||
| 264 | ]; |
||
| 265 | $this->assertEquals($expected, $this->Edexml->convertStudent($data)); |
||
| 266 | |||
| 267 | $data = [ |
||
| 268 | '@key' => 'key', |
||
| 269 | '@eckid' => 'https://id.school/LL_123467890abcdefghijklmnopqrstuvwxzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^_-', |
||
| 270 | 'achternaam' => 'Achternaam', |
||
| 271 | 'roepnaam' => 'Roepnaam', |
||
| 272 | 'geboortedatum' => '2005-07-19', |
||
| 273 | 'geslacht' => '0' |
||
| 274 | ]; |
||
| 275 | $expected = [ |
||
| 276 | 'key' => 'key', |
||
| 277 | 'eckid' => 'https://id.school/LL_123467890abcdefghijklmnopqrstuvwxzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^_-', |
||
| 278 | 'last_name' => 'Achternaam', |
||
| 279 | 'first_name' => 'Roepnaam', |
||
| 280 | 'date_of_birth' => '2005-07-19', |
||
| 281 | 'gender' => null, |
||
| 282 | 'grade' => null, |
||
| 283 | 'SchoolClass' => [] |
||
| 284 | ]; |
||
| 285 | $this->assertEquals($expected, $this->Edexml->convertStudent($data)); |
||
| 286 | |||
| 287 | $data = [ |
||
| 288 | '@key' => 'key', |
||
| 289 | 'achternaam' => 'Achternaam', |
||
| 290 | 'roepnaam' => 'Roepnaam', |
||
| 291 | 'geboortedatum' => '2005-07-19', |
||
| 292 | 'geslacht' => '0', |
||
| 293 | 'groep' => [ |
||
| 294 | '@key' => 'key' |
||
| 295 | ] |
||
| 296 | ]; |
||
| 297 | $expected = [ |
||
| 298 | 'key' => 'key', |
||
| 299 | 'last_name' => 'Achternaam', |
||
| 300 | 'first_name' => 'Roepnaam', |
||
| 301 | 'date_of_birth' => '2005-07-19', |
||
| 302 | 'gender' => null, |
||
| 303 | 'grade' => 10, |
||
| 304 | 'SchoolClass' => [ |
||
| 305 | 'key' => [ |
||
| 306 | 'grade' => 10 |
||
| 307 | ] |
||
| 308 | ] |
||
| 309 | ]; |
||
| 310 | $schoolClasses = [ |
||
| 311 | 'key' => [ |
||
| 312 | 'grade' => 10 |
||
| 313 | ] |
||
| 314 | ]; |
||
| 315 | $this->Edexml->schoolClasses($schoolClasses); |
||
| 316 | $this->assertEquals($expected, $this->Edexml->convertStudent($data)); |
||
| 317 | |||
| 318 | $data = [ |
||
| 319 | 'achternaam' => 'Achternaam', |
||
| 320 | 'roepnaam' => 'Roepnaam', |
||
| 321 | 'geslacht' => '1' |
||
| 322 | ]; |
||
| 323 | $expected = [ |
||
| 324 | 'key' => null, |
||
| 325 | 'first_name' => 'Roepnaam', |
||
| 326 | 'last_name' => 'Achternaam', |
||
| 327 | 'gender' => 'm', |
||
| 328 | 'date_of_birth' => null, |
||
| 329 | 'grade' => null, |
||
| 330 | 'SchoolClass' => [] |
||
| 331 | ]; |
||
| 332 | $this->assertEquals($expected, $this->Edexml->convertStudent($data)); |
||
| 333 | |||
| 334 | $data = [ |
||
| 335 | 'achternaam' => 'Achternaam', |
||
| 336 | 'roepnaam' => 'Roepnaam', |
||
| 337 | 'geslacht' => '2' |
||
| 338 | ]; |
||
| 339 | $actual = $this->Edexml->convertStudent($data); |
||
| 340 | $this->assertEquals('Achternaam', $actual['last_name']); |
||
| 341 | $this->assertEquals('f', $actual['gender']); |
||
| 342 | |||
| 343 | $data = [ |
||
| 344 | 'achternaam' => 'Achternaam', |
||
| 345 | 'roepnaam' => 'Roepnaam', |
||
| 346 | 'geslacht' => '9' |
||
| 347 | ]; |
||
| 348 | $actual = $this->Edexml->convertStudent($data); |
||
| 349 | $this->assertEquals('Achternaam', $actual['last_name']); |
||
| 350 | $this->assertNull($actual['gender']); |
||
| 351 | |||
| 352 | $data = [ |
||
| 353 | 'achternaam' => 'Achternaam', |
||
| 354 | 'voorvoegsel' => 'Voorvoegsel', |
||
| 355 | 'roepnaam' => 'Roepnaam' |
||
| 356 | ]; |
||
| 357 | $actual = $this->Edexml->convertStudent($data); |
||
| 358 | $this->assertEquals('Voorvoegsel Achternaam', $actual['last_name']); |
||
| 359 | $this->assertEquals('Roepnaam', $actual['first_name']); |
||
| 360 | |||
| 361 | $data = [ |
||
| 362 | 'achternaam' => 'Achternaam', |
||
| 363 | 'voorletters-1' => 'KLM', |
||
| 364 | ]; |
||
| 365 | $actual = $this->Edexml->convertStudent($data); |
||
| 366 | $this->assertEquals('KLM', $actual['first_name']); |
||
| 367 | |||
| 368 | $data = [ |
||
| 369 | 'achternaam' => 'Achternaam', |
||
| 370 | 'voornamen' => 'Voornaam1 Voornaam2', |
||
| 371 | ]; |
||
| 372 | $actual = $this->Edexml->convertStudent($data); |
||
| 373 | $this->assertEquals('Voornaam1 Voornaam2', $actual['first_name']); |
||
| 374 | |||
| 375 | $data = [ |
||
| 376 | 'achternaam' => 'Achternaam', |
||
| 377 | 'roepnaam' => 'Roepnaam', |
||
| 378 | 'voornamen' => 'Voornaam1 Voornaam2', |
||
| 379 | 'voorletters-1' => 'KLM', |
||
| 380 | ]; |
||
| 381 | $actual = $this->Edexml->convertStudent($data); |
||
| 382 | $this->assertEquals('Roepnaam', $actual['first_name']); |
||
| 383 | |||
| 384 | // Check dummy key for example #001 |
||
| 385 | // TODO: what to do when there are no identifiers? |
||
| 386 | $data = [ |
||
| 387 | '@key' => '#001', |
||
| 388 | 'achternaam' => 'Achternaam', |
||
| 389 | 'voorvoegsel' => 'Voorvoegsel', |
||
| 390 | 'roepnaam' => 'Roepnaam' |
||
| 391 | ]; |
||
| 392 | $actual = $this->Edexml->convertStudent($data); |
||
| 393 | $this->assertNull($actual['key']); |
||
| 394 | } |
||
| 395 | |||
| 396 | /** |
||
| 397 | * Tests `convertTeacher`. |
||
| 398 | * |
||
| 399 | * @return void |
||
| 400 | */ |
||
| 401 | public function testConvertTeacher() { |
||
| 402 | $data = [ |
||
| 403 | '@key' => 'key', |
||
| 404 | 'achternaam' => 'Achternaam', |
||
| 405 | 'roepnaam' => 'Roepnaam', |
||
| 406 | ]; |
||
| 407 | $expected = [ |
||
| 408 | 'key' => 'key', |
||
| 409 | 'last_name' => 'Achternaam', |
||
| 410 | 'first_name' => 'Roepnaam', |
||
| 411 | 'date_of_birth' => null, |
||
| 412 | 'gender' => null, |
||
| 413 | 'grade' => null, |
||
| 414 | 'email_address' => null, |
||
| 415 | 'SchoolClass' => [] |
||
| 416 | ]; |
||
| 417 | $this->assertEquals($expected, $this->Edexml->convertTeacher($data)); |
||
| 418 | |||
| 419 | $data = [ |
||
| 420 | '@key' => 'key', |
||
| 421 | '@eckid' => 'https://id.school/LK_abcdefghijklmnopqrstuvwxzABCDEFGHIJKLMNOPQRSTUVWXYZ123467890!@#$%^_-', |
||
| 422 | 'achternaam' => 'Achternaam', |
||
| 423 | 'roepnaam' => 'Roepnaam', |
||
| 424 | ]; |
||
| 425 | $expected = [ |
||
| 426 | 'key' => 'key', |
||
| 427 | 'eckid' => 'https://id.school/LK_abcdefghijklmnopqrstuvwxzABCDEFGHIJKLMNOPQRSTUVWXYZ123467890!@#$%^_-', |
||
| 428 | 'last_name' => 'Achternaam', |
||
| 429 | 'first_name' => 'Roepnaam', |
||
| 430 | 'date_of_birth' => null, |
||
| 431 | 'gender' => null, |
||
| 432 | 'grade' => null, |
||
| 433 | 'email_address' => null, |
||
| 434 | 'SchoolClass' => [] |
||
| 435 | ]; |
||
| 436 | $this->assertEquals($expected, $this->Edexml->convertTeacher($data)); |
||
| 437 | |||
| 438 | $data = [ |
||
| 439 | '@key' => 'key', |
||
| 440 | 'achternaam' => 'Achternaam', |
||
| 441 | 'roepnaam' => 'Roepnaam', |
||
| 442 | 'emailadres' => '[email protected]', |
||
| 443 | ]; |
||
| 444 | $expected = [ |
||
| 445 | 'key' => 'key', |
||
| 446 | 'last_name' => 'Achternaam', |
||
| 447 | 'first_name' => 'Roepnaam', |
||
| 448 | 'date_of_birth' => null, |
||
| 449 | 'gender' => null, |
||
| 450 | 'grade' => null, |
||
| 451 | 'email_address' => '[email protected]', |
||
| 452 | 'SchoolClass' => [] |
||
| 453 | ]; |
||
| 454 | $this->assertEquals($expected, $this->Edexml->convertTeacher($data)); |
||
| 455 | |||
| 456 | $data = [ |
||
| 457 | '@key' => 'key', |
||
| 458 | 'achternaam' => 'Achternaam', |
||
| 459 | 'voorletters-1' => 'KLM', |
||
| 460 | 'emailadres' => '[email protected]', |
||
| 461 | ]; |
||
| 462 | $expected = [ |
||
| 463 | 'key' => 'key', |
||
| 464 | 'last_name' => 'Achternaam', |
||
| 465 | 'first_name' => 'KLM', |
||
| 466 | 'date_of_birth' => null, |
||
| 467 | 'gender' => null, |
||
| 468 | 'grade' => null, |
||
| 469 | 'email_address' => '[email protected]', |
||
| 470 | 'SchoolClass' => [] |
||
| 471 | ]; |
||
| 472 | $this->assertEquals($expected, $this->Edexml->convertTeacher($data)); |
||
| 473 | |||
| 474 | $data = [ |
||
| 475 | '@key' => 'key', |
||
| 476 | 'achternaam' => 'Achternaam', |
||
| 477 | 'voornamen' => 'Roepnaam1 Roepnaam2', |
||
| 478 | 'emailadres' => '[email protected]', |
||
| 479 | ]; |
||
| 480 | $expected = [ |
||
| 481 | 'key' => 'key', |
||
| 482 | 'last_name' => 'Achternaam', |
||
| 483 | 'first_name' => 'Roepnaam1 Roepnaam2', |
||
| 484 | 'date_of_birth' => null, |
||
| 485 | 'gender' => null, |
||
| 486 | 'grade' => null, |
||
| 487 | 'email_address' => '[email protected]', |
||
| 488 | 'SchoolClass' => [] |
||
| 489 | ]; |
||
| 490 | $this->assertEquals($expected, $this->Edexml->convertTeacher($data)); |
||
| 491 | } |
||
| 492 | |||
| 493 | /** |
||
| 494 | * Tests `parseToArray`. |
||
| 495 | * |
||
| 496 | * @return void |
||
| 497 | */ |
||
| 498 | public function testParseToArray() { |
||
| 499 | $filename = CakePlugin::path('Edexml') . 'Test' . DS . 'File' . DS . 'EDEXML-1.0.3' . DS . 'sample-invalid.xml'; |
||
|
0 ignored issues
–
show
The type
CakePlugin was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 500 | $this->assertFalse($this->Edexml->parseToArray($filename)); |
||
| 501 | |||
| 502 | $filename = CakePlugin::path('Edexml') . 'Test' . DS . 'File' . DS . 'EDEXML-1.0.3' . DS . 'sample.xml'; |
||
| 503 | $data = $this->Edexml->parseToArray($filename); |
||
| 504 | $this->assertTrue((bool)$data); |
||
| 505 | |||
| 506 | $actual = $this->Edexml->convert($data); |
||
| 507 | $this->assertTrue((bool)$actual); |
||
| 508 | |||
| 509 | $this->assertEquals(count($data['EDEX']['leerlingen']['leerling']), count($actual['Student'])); |
||
| 510 | $this->assertEquals(count($data['EDEX']['groepen']['groep']), count($actual['SchoolClass'])); |
||
| 511 | $this->assertEquals(count($data['EDEX']['leerkrachten']['leerkracht']), count($actual['Teacher'])); |
||
| 512 | } |
||
| 513 | |||
| 514 | /** |
||
| 515 | * Tests `parseToArray`. |
||
| 516 | * |
||
| 517 | * Edex 2.0. |
||
| 518 | * |
||
| 519 | * @return void |
||
| 520 | */ |
||
| 521 | public function testParseToArrayEdexml20SampleFile() { |
||
| 522 | $filename = CakePlugin::path('Edexml') . 'Test' . DS . 'File' . DS . 'EDEXML-2.0' . DS . 'EDEXML.Voorbeeld.2.0.xml'; |
||
|
0 ignored issues
–
show
|
|||
| 523 | $data = $this->Edexml->parseToArray($filename); |
||
| 524 | $this->assertTrue((bool)$data); |
||
| 525 | |||
| 526 | $actual = $this->Edexml->convert($data); |
||
| 527 | $this->assertTrue((bool)$actual); |
||
| 528 | } |
||
| 529 | |||
| 530 | /** |
||
| 531 | * Tests `parseToArray`. |
||
| 532 | * |
||
| 533 | * Edex 2.0. |
||
| 534 | * |
||
| 535 | * @return void |
||
| 536 | */ |
||
| 537 | public function testParseToArrayEdexml20VlaSampleFile() { |
||
| 538 | $filename = CakePlugin::path('Edexml') . 'Test' . DS . 'File' . DS . 'EDEXML-2.0' . DS . 'EDEXML.Voorbeeld.2.0-Vla.xml'; |
||
|
0 ignored issues
–
show
|
|||
| 539 | $data = $this->Edexml->parseToArray($filename); |
||
| 540 | $this->assertTrue((bool)$data); |
||
| 541 | |||
| 542 | $actual = $this->Edexml->convert($data); |
||
| 543 | $this->assertTrue((bool)$actual); |
||
| 544 | } |
||
| 545 | |||
| 546 | /** |
||
| 547 | * Tests `parseToArray`. |
||
| 548 | * |
||
| 549 | * Edex 2.1. |
||
| 550 | * |
||
| 551 | * @return void |
||
| 552 | */ |
||
| 553 | public function testParseToArrayEdexml21SampleFile() { |
||
| 554 | $filename = CakePlugin::path('Edexml') . 'Test' . DS . 'File' . DS . 'EDEXML-2.1' . DS . 'EDEXML.Voorbeeld.2.1.xml'; |
||
|
0 ignored issues
–
show
|
|||
| 555 | $data = $this->Edexml->parseToArray($filename); |
||
| 556 | $this->assertTrue((bool)$data); |
||
| 557 | |||
| 558 | $actual = $this->Edexml->convert($data); |
||
| 559 | $this->assertTrue((bool)$actual); |
||
| 560 | } |
||
| 561 | |||
| 562 | /** |
||
| 563 | * Tests `parseToArray`. |
||
| 564 | * |
||
| 565 | * Edex 2.1. |
||
| 566 | * |
||
| 567 | * @return void |
||
| 568 | */ |
||
| 569 | public function testParseToArrayEdexml21VlaSampleFile() { |
||
| 570 | $filename = CakePlugin::path('Edexml') . 'Test' . DS . 'File' . DS . 'EDEXML-2.1' . DS . 'EDEXML.Voorbeeld.2.1-Vla.xml'; |
||
|
0 ignored issues
–
show
|
|||
| 571 | $data = $this->Edexml->parseToArray($filename); |
||
| 572 | $this->assertTrue((bool)$data); |
||
| 573 | |||
| 574 | $actual = $this->Edexml->convert($data); |
||
| 575 | $this->assertTrue((bool)$actual); |
||
| 576 | } |
||
| 577 | |||
| 578 | /** |
||
| 579 | * Tests `convert`. |
||
| 580 | * |
||
| 581 | * @return void |
||
| 582 | */ |
||
| 583 | public function testConvertSingleItemData() { |
||
| 584 | $data = [ |
||
| 585 | 'EDEX' => [ |
||
| 586 | 'school' => [ |
||
| 587 | 'schooljaar' => '2012-2013', |
||
| 588 | 'brincode' => '99XX', |
||
| 589 | 'dependancecode' => '99', |
||
| 590 | 'schoolkey' => '99999', |
||
| 591 | 'aanmaakdatum' => '2013-03-27T12:43:06', |
||
| 592 | 'auteur' => 'Cito LeerlingVolgSysteem versie 4.6', |
||
| 593 | 'xsdversie' => '1.03' |
||
| 594 | ], |
||
| 595 | 'groepen' => [ |
||
| 596 | 'groep' => [ |
||
| 597 | '@key' => '49', |
||
| 598 | 'naam' => '1A', |
||
| 599 | 'jaargroep' => '1', |
||
| 600 | 'mutatiedatum' => '2005-08-29T22:19:18' |
||
| 601 | ] |
||
| 602 | ], |
||
| 603 | 'leerlingen' => [ |
||
| 604 | 'leerling' => [ |
||
| 605 | '@key' => '3580', |
||
| 606 | 'achternaam' => 'Achternaam', |
||
| 607 | 'voorvoegsel' => 'v. d.', |
||
| 608 | 'roepnaam' => 'Roepnaam', |
||
| 609 | 'geboortedatum' => '2009-08-07', |
||
| 610 | 'geslacht' => '2', |
||
| 611 | 'jaargroep' => '4', |
||
| 612 | 'etniciteit' => '9', |
||
| 613 | 'land' => '?', |
||
| 614 | 'land_vader' => '?', |
||
| 615 | 'land_moeder' => '?', |
||
| 616 | 'gewicht_nieuw' => '?', |
||
| 617 | 'gewicht' => '?', |
||
| 618 | 'mutatiedatum' => '2011-01-24T15:33:29' |
||
| 619 | ] |
||
| 620 | ], |
||
| 621 | 'leerkrachten' => [ |
||
| 622 | 'leerkracht' => [ |
||
| 623 | '@key' => '75', |
||
| 624 | 'achternaam' => 'Achternaam', |
||
| 625 | 'roepnaam' => 'Roepnaam', |
||
| 626 | 'groepen' => [ |
||
| 627 | 'groep' => [ |
||
| 628 | '@key' => '49' |
||
| 629 | ] |
||
| 630 | ], |
||
| 631 | 'mutatiedatum' => '2004-02-07T14:03:18' |
||
| 632 | ] |
||
| 633 | ], |
||
| 634 | '@xsi:noNamespaceSchemaLocation' => 'EDEXML.structuur.xsd' |
||
| 635 | ] |
||
| 636 | ]; |
||
| 637 | |||
| 638 | $actual = $this->Edexml->convert($data); |
||
| 639 | $this->assertTrue(Hash::numeric(array_keys($actual['SchoolClass']))); |
||
| 640 | $this->assertTrue(Hash::numeric(array_keys($actual['Student']))); |
||
| 641 | $this->assertTrue(Hash::numeric(array_keys($actual['Teacher']))); |
||
| 642 | } |
||
| 643 | } |
||
| 644 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths