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