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