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