]> git.agnieray.net Git - galette.git/blob - tests/Galette/IO/tests/units/CsvIn.php
Improve coding standards
[galette.git] / tests / Galette / IO / tests / units / CsvIn.php
1 <?php
2
3 /**
4 * Copyright © 2003-2024 The Galette Team
5 *
6 * This file is part of Galette (https://galette.eu).
7 *
8 * Galette is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * Galette is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 namespace Galette\IO\test\units;
23
24 use Galette\Entity\FieldsConfig;
25 use PHPUnit\Framework\TestCase;
26 use Galette\Entity\Adherent;
27 use Galette\DynamicFields\DynamicField;
28 use Galette\GaletteTestCase;
29
30 /**
31 * CsvIn tests class
32 *
33 * @author Johan Cwiklinski <johan@x-tnd.be>
34 */
35 class CsvIn extends GaletteTestCase
36 {
37 private ?string $contents_table = null;
38
39 /**
40 * Set up tests
41 *
42 * @return void
43 */
44 public function setUp(): void
45 {
46 parent::setUp();
47 $this->contents_table = null;
48 }
49
50 /**
51 * Tear down tests
52 *
53 * @return void
54 */
55 public function tearDown(): void
56 {
57 parent::tearDown();
58
59 $delete = $this->zdb->delete(\Galette\Entity\Adherent::TABLE);
60 $this->zdb->execute($delete);
61 $delete = $this->zdb->delete(\Galette\Entity\DynamicFieldsHandle::TABLE);
62 $this->zdb->execute($delete);
63 $delete = $this->zdb->delete(DynamicField::TABLE);
64 $this->zdb->execute($delete);
65 //cleanup dynamic translations
66 $delete = $this->zdb->delete(\Galette\Core\L10n::TABLE);
67 $delete->where([
68 'text_orig' => [
69 'Dynamic choice field',
70 'Dynamic date field',
71 'Dynamic text field'
72 ]
73 ]);
74 $this->zdb->execute($delete);
75
76 if ($this->contents_table !== null) {
77 $this->zdb->drop($this->contents_table);
78 }
79 }
80
81 /**
82 * Import text CSV file
83 *
84 * @param array $fields Fields name to use at import
85 * @param string $file_name File name
86 * @param array $flash_messages Expected flash messages from doImport route
87 * @param array $members_list List of faked members data
88 * @param integer $count_before Count before insertions. Defaults to 0 if null.
89 * @param integer $count_after Count after insertions. Default to $count_before + count $members_list
90 * @param array $values Textual values for dynamic choices fields
91 *
92 * @return void
93 */
94 private function doImportFileTest(
95 array $fields,
96 string $file_name,
97 array $flash_messages,
98 array $members_list,
99 int $count_before = null,
100 int $count_after = null,
101 array $values = []
102 ): void {
103 if ($count_before === null) {
104 $count_before = 0;
105 }
106 if ($count_after === null) {
107 $count_after = $count_before + count($members_list);
108 }
109
110 $members = new \Galette\Repository\Members();
111 $list = $members->getList();
112 $this->assertSame(
113 $count_before,
114 $list->count(),
115 print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1), true)
116 );
117
118 $model = $this->getModel($fields);
119
120 //get csv model file to add data in
121 $controller = new \Galette\Controllers\CsvController($this->container);
122 $this->container->injectOn($controller);
123
124 $rfactory = new \Slim\Psr7\Factory\RequestFactory();
125 $request = $rfactory->createRequest('GET', 'http://localhost/models/csv');
126 $response = new \Slim\Psr7\Response();
127
128 $response = $controller->getImportModel($request, $response);
129 $csvin = new \Galette\IO\CsvIn($this->container->get('zdb'));
130
131 $this->assertSame(200, $response->getStatusCode());
132 $headers = $response->getHeaders();
133 $this->assertIsArray($headers);
134 $this->assertSame(['text/csv'], $headers['Content-Type']);
135 $this->assertSame(
136 ['attachment;filename="galette_import_model.csv"'],
137 $headers['Content-Disposition']
138 );
139
140 $csvfile_model = $response->getBody()->__toString();
141 $this->assertSame(
142 "\"" . implode("\";\"", $fields) . "\"\r\n",
143 $csvfile_model
144 );
145
146 $contents = $csvfile_model;
147 foreach ($members_list as $member) {
148 $amember = [];
149 foreach ($fields as $field) {
150 $amember[$field] = $member[$field];
151 }
152 $contents .= "\"" . implode("\";\"", $amember) . "\"\r\n";
153 }
154
155 $path = GALETTE_CACHE_DIR . $file_name;
156 $this->assertIsInt(file_put_contents($path, $contents));
157 $_FILES['new_file'] = [
158 'error' => UPLOAD_ERR_OK,
159 'name' => $file_name,
160 'tmp_name' => $path,
161 'size' => filesize($path)
162 ];
163 $this->assertTrue($csvin->store($_FILES['new_file'], true));
164 $this->assertTrue(file_exists($csvin->getDestDir() . $csvin->getFileName()));
165
166 $post = [
167 'import_file' => $file_name
168 ];
169
170 $request = clone $request;
171 $request = $request->withParsedBody($post);
172
173 $response = $controller->doImports($request, $response);
174 $this->assertSame(301, $response->getStatusCode());
175 $this->assertSame($flash_messages, $this->flash_data['slimFlash']);
176 $this->flash->clearMessages();
177
178 $members = new \Galette\Repository\Members();
179 $list = $members->getList();
180 $this->assertSame($count_after, $list->count());
181
182 if ($count_before != $count_after) {
183 foreach ($list as $member) {
184 $created = $members_list[$member->fingerprint];
185 foreach ($fields as $field) {
186 if (property_exists($member, $field)) {
187 $this->assertEquals($created[$field], $member->$field);
188 } else {
189 //manage dynamic fields
190 $matches = [];
191 if (preg_match('/^dynfield_(\d+)/', $field, $matches)) {
192 $adh = new Adherent($this->zdb, (int)$member->id_adh, ['dynamics' => true]);
193 $expected = [
194 [
195 'item_id' => $adh->id,
196 'field_form' => 'adh',
197 'val_index' => 1,
198 'field_val' => $created[$field]
199 ]
200 ];
201
202 $dfield = $adh->getDynamicFields()->getValues($matches[1]);
203 if (isset($dfield[0]['text_val'])) {
204 //choice, add textual value
205 $expected[0]['text_val'] = $values[$created[$field]];
206 }
207
208 $this->assertEquals(
209 $expected,
210 $adh->getDynamicFields()->getValues($matches[1])
211 );
212 } else {
213 throw new \RuntimeException("Unknown field $field");
214 }
215 }
216 }
217 }
218 }
219 }
220
221 /**
222 * Test CSV import loading
223 *
224 * @return void
225 */
226 public function testImport(): void
227 {
228 $fields = ['nom_adh', 'ville_adh', 'bool_exempt_adh', 'fingerprint'];
229 $file_name = 'test-import-atoum.csv';
230 $flash_messages = [
231 'success_detected' => ["File '$file_name' has been successfully imported :)"]
232 ];
233 $members_list = $this->getMemberData1();
234 $count_before = 0;
235 $count_after = 10;
236
237 $this->doImportFileTest($fields, $file_name, $flash_messages, $members_list, $count_before, $count_after);
238
239 //missing name
240 $file_name = 'test-import-atoum-noname.csv';
241 $flash_messages = [
242 'error_detected' => [
243 'File does not comply with requirements.',
244 'Field nom_adh is required, but missing in row 3'
245 ]
246 ];
247
248 $members_list = $this->getMemberData2NoName();
249 $count_before = 10;
250 $count_after = 10;
251
252 $this->doImportFileTest($fields, $file_name, $flash_messages, $members_list, $count_before, $count_after);
253 }
254
255 /**
256 * Get CSV import model
257 *
258 * @param array $fields Fields list
259 *
260 * @return \Galette\Entity\ImportModel
261 */
262 protected function getModel(array $fields): \Galette\Entity\ImportModel
263 {
264 $model = new \Galette\Entity\ImportModel();
265 $this->assertTrue($model->remove($this->zdb));
266
267 $this->assertInstanceOf(\Galette\Entity\ImportModel::class, $model->setFields($fields));
268 $this->assertTrue($model->store($this->zdb));
269 $this->assertTrue($model->load());
270 return $model;
271 }
272
273 /**
274 * Test dynamic translation has been added properly
275 *
276 * @param string $text_orig Original text
277 * @param string $lang Lang text has been added in
278 *
279 * @return void
280 */
281 protected function checkDynamicTranslation(string $text_orig, string $lang = 'fr_FR.utf8'): void
282 {
283 $langs = array_keys($this->i18n->getArrayList());
284 $select = $this->zdb->select(\Galette\Core\L10n::TABLE);
285 $select->columns([
286 'text_locale',
287 'text_nref',
288 'text_trans'
289 ]);
290 $select->where(['text_orig' => $text_orig]);
291 $results = $this->zdb->execute($select);
292 $this->assertSame(count($langs), $results->count());
293
294 foreach ($results as $result) {
295 $this->assertTrue(in_array(str_replace('.utf8', '', $result['text_locale']), $langs));
296 $this->assertSame(1, (int)$result['text_nref']);
297 $this->assertSame(
298 ($result['text_locale'] == 'en_US' ? $text_orig : ''),
299 $result['text_trans']
300 );
301 }
302 }
303
304 /**
305 * Test import with dynamic fields
306 *
307 * @return void
308 */
309 public function testImportDynamics(): void
310 {
311
312 $field_data = [
313 'form_name' => 'adh',
314 'field_name' => 'Dynamic text field',
315 'field_perm' => FieldsConfig::USER_WRITE,
316 'field_type' => DynamicField::TEXT,
317 'field_required' => 1,
318 'field_repeat' => 1
319 ];
320
321 $df = DynamicField::getFieldType($this->zdb, $field_data['field_type']);
322
323 $stored = $df->store($field_data);
324 $error_detected = $df->getErrors();
325 $warning_detected = $df->getWarnings();
326 $this->assertTrue(
327 $stored,
328 implode(
329 ' ',
330 $df->getErrors() + $df->getWarnings()
331 )
332 );
333 $this->assertEmpty($error_detected, implode(' ', $df->getErrors()));
334 $this->assertEmpty($warning_detected, implode(' ', $df->getWarnings()));
335 //check if dynamic translation has been added
336 $this->checkDynamicTranslation($field_data['field_name']);
337
338 $select = $this->zdb->select(DynamicField::TABLE);
339 $select->columns(array('num' => new \Laminas\Db\Sql\Expression('COUNT(1)')));
340 $result = $this->zdb->execute($select)->current();
341 $this->assertSame(1, (int)$result->num);
342
343 $fields = ['nom_adh', 'ville_adh', 'dynfield_' . $df->getId(), 'fingerprint'];
344 $file_name = 'test-import-atoum-dyn.csv';
345 $flash_messages = [
346 'success_detected' => ["File '$file_name' has been successfully imported :)"]
347 ];
348 $members_list = $this->getMemberData1();
349 foreach ($members_list as $fingerprint => &$data) {
350 $data['dynfield_' . $df->getId()] = 'Dynamic field value for ' . $data['fingerprint'];
351 }
352 $count_before = 0;
353 $count_after = 10;
354
355 $this->doImportFileTest($fields, $file_name, $flash_messages, $members_list, $count_before, $count_after);
356
357 //missing name
358 //$fields does not change from previous
359 $file_name = 'test-import-atoum-dyn-noname.csv';
360 $flash_messages = [
361 'error_detected' => [
362 'File does not comply with requirements.',
363 'Field nom_adh is required, but missing in row 3'
364 ]
365 ];
366 $members_list = $this->getMemberData2NoName();
367 foreach ($members_list as $fingerprint => &$data) {
368 $data['dynfield_' . $df->getId()] = 'Dynamic field value for ' . $data['fingerprint'];
369 }
370
371 $count_before = 10;
372 $count_after = 10;
373
374 $this->doImportFileTest($fields, $file_name, $flash_messages, $members_list, $count_before, $count_after);
375
376 //missing required dynamic field
377 //$fields does not change from previous
378 $file_name = 'test-import-atoum-dyn-nodyn.csv';
379 $flash_messages = [
380 'error_detected' => [
381 'File does not comply with requirements.',
382 'Missing required field Dynamic text field'
383 ]
384 ];
385 $members_list = $this->getMemberData2();
386 $i = 0;
387 foreach ($members_list as $fingerprint => &$data) {
388 //two lines without required dynamic field.
389 $data['dynfield_' . $df->getId()] = (($i == 2 || $i == 5) ? '' :
390 'Dynamic field value for ' . $data['fingerprint']);
391 ++$i;
392 }
393
394 $count_before = 10;
395 $count_after = 10;
396
397 $this->doImportFileTest($fields, $file_name, $flash_messages, $members_list, $count_before, $count_after);
398
399 //cleanup members and dynamic fields values
400 $delete = $this->zdb->delete(\Galette\Entity\Adherent::TABLE);
401 $this->zdb->execute($delete);
402 $delete = $this->zdb->delete(\Galette\Entity\DynamicFieldsHandle::TABLE);
403 $this->zdb->execute($delete);
404
405 //new dynamic field, of type choice.
406 $values = [
407 'First value',
408 'Second value',
409 'Third value'
410 ];
411 $cfield_data = [
412 'form_name' => 'adh',
413 'field_name' => 'Dynamic choice field',
414 'field_perm' => FieldsConfig::USER_WRITE,
415 'field_type' => DynamicField::CHOICE,
416 'field_required' => 0,
417 'field_repeat' => 1,
418 'fixed_values' => implode("\n", $values)
419 ];
420
421 $cdf = DynamicField::getFieldType($this->zdb, $cfield_data['field_type']);
422
423 $stored = $cdf->store($cfield_data);
424 $error_detected = $cdf->getErrors();
425 $warning_detected = $cdf->getWarnings();
426 $this->assertTrue(
427 $stored,
428 implode(
429 ' ',
430 $cdf->getErrors() + $cdf->getWarnings()
431 )
432 );
433 $this->assertEmpty($error_detected, implode(' ', $cdf->getErrors()));
434 $this->assertEmpty($warning_detected, implode(' ', $cdf->getWarnings()));
435 //check if dynamic translation has been added
436 $this->checkDynamicTranslation($cfield_data['field_name']);
437
438 $select = $this->zdb->select(DynamicField::TABLE);
439 $select->columns(array('num' => new \Laminas\Db\Sql\Expression('COUNT(1)')));
440 $result = $this->zdb->execute($select)->current();
441 $this->assertSame(2, (int)$result->num);
442
443 $this->assertSame($values, $cdf->getValues());
444
445 $fields = ['nom_adh', 'ville_adh', 'dynfield_' . $cdf->getId(), 'fingerprint'];
446 $file_name = 'test-import-atoum-dyn-cdyn.csv';
447 $flash_messages = [
448 'success_detected' => ["File '$file_name' has been successfully imported :)"]
449 ];
450 $members_list = $this->getMemberData1();
451 foreach ($members_list as $fingerprint => &$data) {
452 //two lines without required dynamic field.
453 $data['dynfield_' . $cdf->getId()] = rand(0, 2);
454 }
455
456 $count_before = 0;
457 $count_after = 10;
458
459 $this->doImportFileTest(
460 $fields,
461 $file_name,
462 $flash_messages,
463 $members_list,
464 $count_before,
465 $count_after,
466 $values
467 );
468
469 //cleanup members and dynamic fields values
470 $delete = $this->zdb->delete(\Galette\Entity\Adherent::TABLE);
471 $this->zdb->execute($delete);
472 $delete = $this->zdb->delete(\Galette\Entity\DynamicFieldsHandle::TABLE);
473 $this->zdb->execute($delete);
474 //cleanup dynamic choices table
475 $this->contents_table = $cdf->getFixedValuesTableName($cdf->getId());
476
477 //new dynamic field, of type date.
478 $cfield_data = [
479 'form_name' => 'adh',
480 'field_name' => 'Dynamic date field',
481 'field_perm' => FieldsConfig::USER_WRITE,
482 'field_type' => DynamicField::DATE,
483 'field_required' => 0,
484 'field_repeat' => 1
485 ];
486
487 $cdf = DynamicField::getFieldType($this->zdb, $cfield_data['field_type']);
488
489 $stored = $cdf->store($cfield_data);
490 $error_detected = $cdf->getErrors();
491 $warning_detected = $cdf->getWarnings();
492 $this->assertTrue(
493 $stored,
494 implode(
495 ' ',
496 $cdf->getErrors() + $cdf->getWarnings()
497 )
498 );
499 $this->assertEmpty($error_detected, implode(' ', $cdf->getErrors()));
500 $this->assertEmpty($warning_detected, implode(' ', $cdf->getWarnings()));
501 //check if dynamic translation has been added
502 $this->checkDynamicTranslation($cfield_data['field_name']);
503
504 $select = $this->zdb->select(DynamicField::TABLE);
505 $select->columns(array('num' => new \Laminas\Db\Sql\Expression('COUNT(1)')));
506 $result = $this->zdb->execute($select)->current();
507 $this->assertSame(3, (int)$result->num);
508
509
510 $fields = ['nom_adh', 'ville_adh', 'dynfield_' . $cdf->getId(), 'fingerprint'];
511 $file_name = 'test-import-atoum-cdyn-date.csv';
512 $flash_messages = [
513 'success_detected' => ["File '$file_name' has been successfully imported :)"]
514 ];
515 $members_list = $this->getMemberData1();
516 foreach ($members_list as $fingerprint => &$data) {
517 //two lines without required dynamic field.
518 $data['dynfield_' . $cdf->getId()] = $data['date_crea_adh'];
519 }
520
521 $count_before = 0;
522 $count_after = 10;
523
524 $this->doImportFileTest($fields, $file_name, $flash_messages, $members_list, $count_before, $count_after);
525
526 //Test with a bad date
527 //$fields does not change from previous
528 $file_name = 'test-import-atoum-cdyn-baddate.csv';
529 $flash_messages = [
530 'error_detected' => [
531 'File does not comply with requirements.',
532 '- Wrong date format (Y-m-d) for Dynamic date field!'
533 ]
534 ];
535 $members_list = $this->getMemberData2();
536 $i = 0;
537 foreach ($members_list as $fingerprint => &$data) {
538 //two lines without required dynamic field.
539 $data['dynfield_' . $cdf->getId()] = (($i == 2 || $i == 5) ? '20200513' : $data['date_crea_adh']);
540 ++$i;
541 }
542
543 $count_before = 10;
544 $count_after = 10;
545
546 $this->doImportFileTest($fields, $file_name, $flash_messages, $members_list, $count_before, $count_after);
547 }
548
549 /**
550 * Get first set of member data
551 *
552 * @return array
553 */
554 private function getMemberData1(): array
555 {
556 return array(
557 'FAKER_0' => array (
558 'nom_adh' => 'Boucher',
559 'prenom_adh' => 'Roland',
560 'ville_adh' => 'Dumas',
561 'cp_adh' => '61276',
562 'adresse_adh' => '5, chemin de Meunier',
563 'email_adh' => 'remy44@lopez.net',
564 'login_adh' => 'jean36',
565 'mdp_adh' => 'HM~OCSl[]UkZp%Y',
566 'mdp_adh2' => 'HM~OCSl[]UkZp%Y',
567 'bool_admin_adh' => false,
568 'bool_exempt_adh' => true,
569 'bool_display_info' => false,
570 'sexe_adh' => 1,
571 'prof_adh' => 'Technicien géomètre',
572 'titre_adh' => null,
573 'ddn_adh' => '1914-03-22',
574 'lieu_naissance' => 'Laurent-sur-Guyot',
575 'pseudo_adh' => 'tgonzalez',
576 'pays_adh' => null,
577 'tel_adh' => '+33 8 93 53 99 52',
578 'activite_adh' => true,
579 'id_statut' => 9,
580 'date_crea_adh' => '2020-03-09',
581 'pref_lang' => 'br',
582 'fingerprint' => 'FAKER_0',
583 ),
584 'FAKER_1' => array (
585 'nom_adh' => 'Lefebvre',
586 'prenom_adh' => 'François',
587 'ville_adh' => 'Laine',
588 'cp_adh' => '53977',
589 'adresse_adh' => '311, rue de Costa',
590 'email_adh' => 'astrid64@masse.fr',
591 'login_adh' => 'olivier.pierre',
592 'mdp_adh' => '.4y/J>yN_QUh7Bw@NW>)',
593 'mdp_adh2' => '.4y/J>yN_QUh7Bw@NW>)',
594 'bool_admin_adh' => false,
595 'bool_exempt_adh' => false,
596 'bool_display_info' => false,
597 'sexe_adh' => 2,
598 'prof_adh' => 'Conseiller relooking',
599 'titre_adh' => null,
600 'ddn_adh' => '1989-10-31',
601 'lieu_naissance' => 'Collet',
602 'pseudo_adh' => 'agnes.evrard',
603 'pays_adh' => null,
604 'tel_adh' => '0288284193',
605 'activite_adh' => true,
606 'id_statut' => 9,
607 'date_crea_adh' => '2019-11-29',
608 'pref_lang' => 'oc',
609 'fingerprint' => 'FAKER_1',
610 ),
611 'FAKER_2' => array (
612 'nom_adh' => 'Lemaire',
613 'prenom_adh' => 'Georges',
614 'ville_adh' => 'Teixeira-sur-Mer',
615 'cp_adh' => '40141',
616 'adresse_adh' => 'place Guillaume',
617 'email_adh' => 'lefort.vincent@club-internet.fr',
618 'login_adh' => 'josette46',
619 'mdp_adh' => '(IqBaAIR',
620 'mdp_adh2' => '(IqBaAIR',
621 'bool_admin_adh' => false,
622 'bool_exempt_adh' => false,
623 'bool_display_info' => true,
624 'sexe_adh' => 0,
625 'prof_adh' => 'Assistant logistique',
626 'titre_adh' => null,
627 'ddn_adh' => '1935-09-07',
628 'lieu_naissance' => 'Ponsboeuf',
629 'pseudo_adh' => 'fgay',
630 'pays_adh' => null,
631 'tel_adh' => '+33 7 45 45 19 81',
632 'activite_adh' => true,
633 'id_statut' => 8,
634 'date_crea_adh' => '2019-02-03',
635 'pref_lang' => 'uk',
636 'fingerprint' => 'FAKER_2',
637 ),
638 'FAKER_3' => array (
639 'nom_adh' => 'Paul',
640 'prenom_adh' => 'Thibaut',
641 'ville_adh' => 'Mallet-sur-Prevost',
642 'cp_adh' => '50537',
643 'adresse_adh' => '246, boulevard Daniel Mendes',
644 'email_adh' => 'ihamel@pinto.fr',
645 'login_adh' => 'josephine.fabre',
646 'mdp_adh' => '`2LrQcb9Utgm=Y\\S$',
647 'mdp_adh2' => '`2LrQcb9Utgm=Y\\S$',
648 'bool_admin_adh' => false,
649 'bool_exempt_adh' => false,
650 'bool_display_info' => true,
651 'sexe_adh' => 0,
652 'prof_adh' => 'Aide à domicile',
653 'titre_adh' => null,
654 'ddn_adh' => '1961-09-17',
655 'lieu_naissance' => 'Gomez',
656 'pseudo_adh' => 'chauvin.guillaume',
657 'pays_adh' => 'Hong Kong',
658 'tel_adh' => '+33 5 48 57 32 28',
659 'activite_adh' => true,
660 'id_statut' => 1,
661 'date_crea_adh' => '2017-11-20',
662 'pref_lang' => 'nb_NO',
663 'fingerprint' => 'FAKER_3',
664 'societe_adh' => 'Jacques',
665 'is_company' => true,
666 ),
667 'FAKER_4' => array (
668 'nom_adh' => 'Pascal',
669 'prenom_adh' => 'Isaac',
670 'ville_adh' => 'Jourdanboeuf',
671 'cp_adh' => '93966',
672 'adresse_adh' => '5, boulevard de Boucher',
673 'email_adh' => 'valerie.becker@gmail.com',
674 'login_adh' => 'lucie08',
675 'mdp_adh' => '|%+wtMW{l',
676 'mdp_adh2' => '|%+wtMW{l',
677 'bool_admin_adh' => false,
678 'bool_exempt_adh' => false,
679 'bool_display_info' => true,
680 'sexe_adh' => 1,
681 'prof_adh' => 'Bruiteur',
682 'titre_adh' => null,
683 'ddn_adh' => '1953-12-11',
684 'lieu_naissance' => 'Foucher',
685 'pseudo_adh' => 'sauvage.dorothee',
686 'pays_adh' => 'Bangladesh',
687 'tel_adh' => '+33 4 75 14 66 56',
688 'activite_adh' => false,
689 'id_statut' => 9,
690 'date_crea_adh' => '2018-08-16',
691 'pref_lang' => 'en_US',
692 'fingerprint' => 'FAKER_4',
693 ),
694 'FAKER_5' => array (
695 'nom_adh' => 'Morvan',
696 'prenom_adh' => 'Joseph',
697 'ville_adh' => 'Noel',
698 'cp_adh' => '05069',
699 'adresse_adh' => 'place de Barthelemy',
700 'email_adh' => 'claunay@tele2.fr',
701 'login_adh' => 'marthe.hoarau',
702 'mdp_adh' => '\'C?}vJAU>:-iE',
703 'mdp_adh2' => '\'C?}vJAU>:-iE',
704 'bool_admin_adh' => false,
705 'bool_exempt_adh' => false,
706 'bool_display_info' => true,
707 'sexe_adh' => 1,
708 'prof_adh' => 'Opérateur du son',
709 'titre_adh' => null,
710 'ddn_adh' => '1938-05-11',
711 'lieu_naissance' => 'Beguedan',
712 'pseudo_adh' => 'andre.guillou',
713 'pays_adh' => null,
714 'tel_adh' => '09 26 70 06 55',
715 'activite_adh' => true,
716 'id_statut' => 9,
717 'date_crea_adh' => '2018-09-28',
718 'pref_lang' => 'ca',
719 'fingerprint' => 'FAKER_5',
720 ),
721 'FAKER_6' => array (
722 'nom_adh' => 'Lebreton',
723 'prenom_adh' => 'Emmanuelle',
724 'ville_adh' => 'Lefevre',
725 'cp_adh' => '29888',
726 'adresse_adh' => '98, rue Moulin',
727 'email_adh' => 'zacharie77@ruiz.fr',
728 'login_adh' => 'marianne.collin',
729 'mdp_adh' => '=jG{wyE',
730 'mdp_adh2' => '=jG{wyE',
731 'bool_admin_adh' => false,
732 'bool_exempt_adh' => false,
733 'bool_display_info' => true,
734 'sexe_adh' => 1,
735 'prof_adh' => 'Galeriste',
736 'titre_adh' => null,
737 'ddn_adh' => '2001-02-01',
738 'lieu_naissance' => 'Berthelot',
739 'pseudo_adh' => 'ferreira.rene',
740 'pays_adh' => 'Tuvalu',
741 'tel_adh' => '+33 (0)7 47 56 89 70',
742 'activite_adh' => true,
743 'id_statut' => 9,
744 'date_crea_adh' => '2018-01-13',
745 'pref_lang' => 'es',
746 'fingerprint' => 'FAKER_6',
747 ),
748 'FAKER_7' => array (
749 'nom_adh' => 'Maurice',
750 'prenom_adh' => 'Capucine',
751 'ville_adh' => 'Renaultdan',
752 'cp_adh' => '59 348',
753 'adresse_adh' => '56, avenue Grenier',
754 'email_adh' => 'didier.emmanuel@tiscali.fr',
755 'login_adh' => 'william.herve',
756 'mdp_adh' => '#7yUz#qToZ\'',
757 'mdp_adh2' => '#7yUz#qToZ\'',
758 'bool_admin_adh' => false,
759 'bool_exempt_adh' => false,
760 'bool_display_info' => true,
761 'sexe_adh' => 1,
762 'prof_adh' => 'Cintrier-machiniste',
763 'titre_adh' => null,
764 'ddn_adh' => '1984-04-17',
765 'lieu_naissance' => 'Rolland',
766 'pseudo_adh' => 'roger27',
767 'pays_adh' => 'Antilles néerlandaises',
768 'tel_adh' => '0922523762',
769 'activite_adh' => true,
770 'id_statut' => 9,
771 'date_crea_adh' => '2020-02-13',
772 'pref_lang' => 'br',
773 'fingerprint' => 'FAKER_7',
774 'societe_adh' => 'Mace',
775 'is_company' => true,
776 ),
777 'FAKER_8' => array (
778 'nom_adh' => 'Hubert',
779 'prenom_adh' => 'Lucy',
780 'ville_adh' => 'Lagarde',
781 'cp_adh' => '22 829',
782 'adresse_adh' => '3, rue Pénélope Marie',
783 'email_adh' => 'zoe02@morvan.com',
784 'login_adh' => 'bernard.agathe',
785 'mdp_adh' => '@9di}eJyc"0s_d(',
786 'mdp_adh2' => '@9di}eJyc"0s_d(',
787 'bool_admin_adh' => false,
788 'bool_exempt_adh' => false,
789 'bool_display_info' => true,
790 'sexe_adh' => 2,
791 'prof_adh' => 'Facteur',
792 'titre_adh' => null,
793 'ddn_adh' => '2008-01-13',
794 'lieu_naissance' => 'Ribeiro',
795 'pseudo_adh' => 'julien.isabelle',
796 'pays_adh' => 'Mexique',
797 'tel_adh' => '0809527977',
798 'activite_adh' => true,
799 'id_statut' => 9,
800 'date_crea_adh' => '2019-06-26',
801 'pref_lang' => 'de_DE',
802 'fingerprint' => 'FAKER_8',
803 ),
804 'FAKER_9' => array (
805 'nom_adh' => 'Goncalves',
806 'prenom_adh' => 'Corinne',
807 'ville_adh' => 'LesageVille',
808 'cp_adh' => '15728',
809 'adresse_adh' => '18, rue de Pinto',
810 'email_adh' => 'julien.clement@dbmail.com',
811 'login_adh' => 'xavier.nicolas',
812 'mdp_adh' => '<W0XdOj2Gp|@;W}gWh]',
813 'mdp_adh2' => '<W0XdOj2Gp|@;W}gWh]',
814 'bool_admin_adh' => false,
815 'bool_exempt_adh' => false,
816 'bool_display_info' => true,
817 'sexe_adh' => 1,
818 'prof_adh' => 'Eleveur de volailles',
819 'titre_adh' => null,
820 'ddn_adh' => '2013-09-12',
821 'lieu_naissance' => 'Breton',
822 'pseudo_adh' => 'louis.pruvost',
823 'pays_adh' => null,
824 'tel_adh' => '+33 (0)6 80 24 46 58',
825 'activite_adh' => true,
826 'id_statut' => 9,
827 'date_crea_adh' => '2020-08-09',
828 'pref_lang' => 'br',
829 'fingerprint' => 'FAKER_9',
830 )
831 );
832 }
833
834 /**
835 * Get second set of member data
836 * two lines without name.
837 *
838 * @return array
839 */
840 private function getMemberData2(): array
841 {
842 return array (
843 'FAKER_0' => array (
844 'nom_adh' => 'Goncalves',
845 'prenom_adh' => 'Margot',
846 'ville_adh' => 'Alves',
847 'cp_adh' => '76254',
848 'adresse_adh' => '43, impasse Maurice Imbert',
849 'email_adh' => 'guillou.richard@yahoo.fr',
850 'login_adh' => 'suzanne.mathieu',
851 'mdp_adh' => 'Thihk2z0',
852 'mdp_adh2' => 'Thihk2z0',
853 'bool_admin_adh' => false,
854 'bool_exempt_adh' => false,
855 'bool_display_info' => true,
856 'sexe_adh' => 2,
857 'prof_adh' => 'Cueilleur de cerises',
858 'titre_adh' => null,
859 'ddn_adh' => '2020-04-24',
860 'lieu_naissance' => 'Poulain-les-Bains',
861 'pseudo_adh' => 'olivier.roux',
862 'pays_adh' => 'République Dominicaine',
863 'tel_adh' => '08 95 04 73 14',
864 'activite_adh' => true,
865 'id_statut' => 9,
866 'date_crea_adh' => '2020-07-31',
867 'pref_lang' => 'ca',
868 'fingerprint' => 'FAKER_0',
869 ),
870 'FAKER_1' => array (
871 'nom_adh' => 'Da Silva',
872 'prenom_adh' => 'Augustin',
873 'ville_adh' => 'Perrin-sur-Masson',
874 'cp_adh' => '31519',
875 'adresse_adh' => '154, place Boulay',
876 'email_adh' => 'marc60@moreno.fr',
877 'login_adh' => 'hoarau.maryse',
878 'mdp_adh' => '\\9Si%r/FAmz.HE4!{Q\\',
879 'mdp_adh2' => '\\9Si%r/FAmz.HE4!{Q\\',
880 'bool_admin_adh' => false,
881 'bool_exempt_adh' => false,
882 'bool_display_info' => true,
883 'sexe_adh' => 2,
884 'prof_adh' => 'Séismologue',
885 'titre_adh' => null,
886 'ddn_adh' => '1988-06-26',
887 'lieu_naissance' => 'Martel',
888 'pseudo_adh' => 'hchevalier',
889 'pays_adh' => 'Kiribati',
890 'tel_adh' => '04 55 49 80 92',
891 'activite_adh' => true,
892 'id_statut' => 1,
893 'date_crea_adh' => '2020-06-02',
894 'pref_lang' => 'fr_FR',
895 'fingerprint' => 'FAKER_1',
896 ),
897 'FAKER_2' => array (
898 'nom_adh' => 'Doe',
899 'prenom_adh' => 'Laetitia',
900 'ville_adh' => 'SimonBourg',
901 'cp_adh' => '90351',
902 'adresse_adh' => '147, chemin de Chauvet',
903 'email_adh' => 'jean.joseph@pinto.fr',
904 'login_adh' => 'marianne.bourgeois',
905 'mdp_adh' => '[oT:"ExE',
906 'mdp_adh2' => '[oT:"ExE',
907 'bool_admin_adh' => false,
908 'bool_exempt_adh' => false,
909 'bool_display_info' => true,
910 'sexe_adh' => 0,
911 'prof_adh' => 'Porteur de hottes',
912 'titre_adh' => null,
913 'ddn_adh' => '2010-03-13',
914 'lieu_naissance' => 'Gallet',
915 'pseudo_adh' => 'abarre',
916 'pays_adh' => 'Kirghizistan',
917 'tel_adh' => '07 47 63 11 31',
918 'activite_adh' => true,
919 'id_statut' => 9,
920 'date_crea_adh' => '2020-10-28',
921 'pref_lang' => 'ar',
922 'fingerprint' => 'FAKER_2',
923 ),
924 'FAKER_3' => array (
925 'nom_adh' => 'Cordier',
926 'prenom_adh' => 'Olivier',
927 'ville_adh' => 'Lacroixboeuf',
928 'cp_adh' => '58 787',
929 'adresse_adh' => '77, place Gilbert Perrier',
930 'email_adh' => 'adelaide07@yahoo.fr',
931 'login_adh' => 'riou.sebastien',
932 'mdp_adh' => '%"OC/UniE46',
933 'mdp_adh2' => '%"OC/UniE46',
934 'bool_admin_adh' => false,
935 'bool_exempt_adh' => false,
936 'bool_display_info' => false,
937 'sexe_adh' => 2,
938 'prof_adh' => 'Oenologue',
939 'titre_adh' => null,
940 'ddn_adh' => '2010-10-08',
941 'lieu_naissance' => 'Leger',
942 'pseudo_adh' => 'frederique.bernier',
943 'pays_adh' => null,
944 'tel_adh' => '+33 2 50 03 01 12',
945 'activite_adh' => true,
946 'id_statut' => 9,
947 'date_crea_adh' => '2020-08-14',
948 'pref_lang' => 'ar',
949 'fingerprint' => 'FAKER_3',
950 ),
951 'FAKER_4' => array (
952 'nom_adh' => 'Robert',
953 'prenom_adh' => 'Grégoire',
954 'ville_adh' => 'Delannoy-sur-Mer',
955 'cp_adh' => '41185',
956 'adresse_adh' => '15, boulevard de Pierre',
957 'email_adh' => 'normand.matthieu@orange.fr',
958 'login_adh' => 'guilbert.louis',
959 'mdp_adh' => 'y(,HodJF*j',
960 'mdp_adh2' => 'y(,HodJF*j',
961 'bool_admin_adh' => false,
962 'bool_exempt_adh' => false,
963 'bool_display_info' => true,
964 'sexe_adh' => 2,
965 'prof_adh' => 'Mannequin détail',
966 'titre_adh' => null,
967 'ddn_adh' => '1974-05-14',
968 'lieu_naissance' => 'Barbe-sur-Laurent',
969 'pseudo_adh' => 'stoussaint',
970 'pays_adh' => 'Îles Mineures Éloignées des États-Unis',
971 'tel_adh' => '+33 (0)1 30 50 01 54',
972 'activite_adh' => true,
973 'id_statut' => 3,
974 'date_crea_adh' => '2018-12-05',
975 'pref_lang' => 'it_IT',
976 'fingerprint' => 'FAKER_4',
977 'societe_adh' => 'Chretien Martineau S.A.',
978 'is_company' => true,
979 ),
980 'FAKER_5' => array (
981 'nom_adh' => 'Doe',
982 'prenom_adh' => 'Charles',
983 'ville_adh' => 'Charpentier-sur-Lebrun',
984 'cp_adh' => '99129',
985 'adresse_adh' => '817, chemin de Bonnin',
986 'email_adh' => 'guillou.augustin@live.com',
987 'login_adh' => 'dominique80',
988 'mdp_adh' => '~g??E0HE$A>2"e*C7+Kw',
989 'mdp_adh2' => '~g??E0HE$A>2"e*C7+Kw',
990 'bool_admin_adh' => true,
991 'bool_exempt_adh' => false,
992 'bool_display_info' => true,
993 'sexe_adh' => 0,
994 'prof_adh' => 'Commandant de police',
995 'titre_adh' => null,
996 'ddn_adh' => '2007-03-26',
997 'lieu_naissance' => 'Boutin',
998 'pseudo_adh' => 'virginie.jacquet',
999 'pays_adh' => null,
1000 'tel_adh' => '0393209420',
1001 'activite_adh' => true,
1002 'id_statut' => 9,
1003 'date_crea_adh' => '2018-02-17',
1004 'pref_lang' => 'fr_FR',
1005 'fingerprint' => 'FAKER_5',
1006 ),
1007 'FAKER_6' => array (
1008 'nom_adh' => 'Thierry',
1009 'prenom_adh' => 'Louis',
1010 'ville_adh' => 'Henry',
1011 'cp_adh' => '98 144',
1012 'adresse_adh' => '383, avenue Éléonore Bouchet',
1013 'email_adh' => 'bernard.elodie@orange.fr',
1014 'login_adh' => 'ubreton',
1015 'mdp_adh' => 'lTBT@,hsE`co?C2=',
1016 'mdp_adh2' => 'lTBT@,hsE`co?C2=',
1017 'bool_admin_adh' => false,
1018 'bool_exempt_adh' => false,
1019 'bool_display_info' => false,
1020 'sexe_adh' => 2,
1021 'prof_adh' => 'Endocrinologue',
1022 'titre_adh' => null,
1023 'ddn_adh' => '1994-07-19',
1024 'lieu_naissance' => 'Pagesdan',
1025 'pseudo_adh' => 'diallo.sebastien',
1026 'pays_adh' => null,
1027 'tel_adh' => '+33 5 72 28 24 81',
1028 'activite_adh' => true,
1029 'id_statut' => 9,
1030 'date_crea_adh' => '2020-03-16',
1031 'pref_lang' => 'en_US',
1032 'fingerprint' => 'FAKER_6',
1033 ),
1034 'FAKER_7' => array (
1035 'nom_adh' => 'Delattre',
1036 'prenom_adh' => 'Susanne',
1037 'ville_adh' => 'Roche-les-Bains',
1038 'cp_adh' => '37 104',
1039 'adresse_adh' => '44, rue Suzanne Guilbert',
1040 'email_adh' => 'tmartel@wanadoo.fr',
1041 'login_adh' => 'lebreton.alexandre',
1042 'mdp_adh' => '{(3mCWC7[YL]n',
1043 'mdp_adh2' => '{(3mCWC7[YL]n',
1044 'bool_admin_adh' => false,
1045 'bool_exempt_adh' => false,
1046 'bool_display_info' => true,
1047 'sexe_adh' => 0,
1048 'prof_adh' => 'Gérant d\'hôtel',
1049 'titre_adh' => null,
1050 'ddn_adh' => '1914-05-16',
1051 'lieu_naissance' => 'Traore',
1052 'pseudo_adh' => 'helene59',
1053 'pays_adh' => null,
1054 'tel_adh' => '0383453389',
1055 'activite_adh' => true,
1056 'id_statut' => 9,
1057 'date_crea_adh' => '2020-02-03',
1058 'pref_lang' => 'oc',
1059 'fingerprint' => 'FAKER_7',
1060 ),
1061 'FAKER_8' => array (
1062 'nom_adh' => 'Peltier',
1063 'prenom_adh' => 'Inès',
1064 'ville_adh' => 'Thierry-sur-Carre',
1065 'cp_adh' => '80690',
1066 'adresse_adh' => '43, impasse Texier',
1067 'email_adh' => 'qdubois@mendes.fr',
1068 'login_adh' => 'julie.carlier',
1069 'mdp_adh' => '.ATai-E6%LIxE{',
1070 'mdp_adh2' => '.ATai-E6%LIxE{',
1071 'bool_admin_adh' => false,
1072 'bool_exempt_adh' => false,
1073 'bool_display_info' => true,
1074 'sexe_adh' => 1,
1075 'prof_adh' => 'Gynécologue',
1076 'titre_adh' => null,
1077 'ddn_adh' => '1988-05-29',
1078 'lieu_naissance' => 'Dijoux-sur-Michaud',
1079 'pseudo_adh' => 'wpierre',
1080 'pays_adh' => null,
1081 'tel_adh' => '01 32 14 47 74',
1082 'activite_adh' => true,
1083 'id_statut' => 9,
1084 'date_crea_adh' => '2020-03-28',
1085 'pref_lang' => 'ar',
1086 'fingerprint' => 'FAKER_8',
1087 ),
1088 'FAKER_9' => array (
1089 'nom_adh' => 'Marchand',
1090 'prenom_adh' => 'Audrey',
1091 'ville_adh' => 'Lenoirdan',
1092 'cp_adh' => '06494',
1093 'adresse_adh' => '438, place de Carre',
1094 'email_adh' => 'luc42@yahoo.fr',
1095 'login_adh' => 'margot.bousquet',
1096 'mdp_adh' => 'FH,q5udclwM(',
1097 'mdp_adh2' => 'FH,q5udclwM(',
1098 'bool_admin_adh' => false,
1099 'bool_exempt_adh' => false,
1100 'bool_display_info' => true,
1101 'sexe_adh' => 1,
1102 'prof_adh' => 'Convoyeur garde',
1103 'titre_adh' => null,
1104 'ddn_adh' => '1977-09-02',
1105 'lieu_naissance' => 'Arnaud-sur-Antoine',
1106 'pseudo_adh' => 'gerard66',
1107 'pays_adh' => null,
1108 'tel_adh' => '+33 1 46 04 81 87',
1109 'activite_adh' => true,
1110 'id_statut' => 5,
1111 'date_crea_adh' => '2019-05-16',
1112 'pref_lang' => 'fr_FR',
1113 'fingerprint' => 'FAKER_9',
1114 )
1115 );
1116 }
1117
1118 /**
1119 * Get second set of member data but two lines without name.
1120 *
1121 * @return array
1122 */
1123 private function getMemberData2NoName(): array
1124 {
1125 $data = $this->getMemberData2();
1126 $data['FAKER_2']['nom_adh'] = '';
1127 $data['FAKER_5']['nom_adh'] = '';
1128 return $data;
1129 }
1130 }