/
DefaultChoiceListFactoryTest.php
867 lines (740 loc) · 24.7 KB
/
DefaultChoiceListFactoryTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\ChoiceList\Factory;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\ChoiceList\Factory\DefaultChoiceListFactory;
use Symfony\Component\Form\ChoiceList\LazyChoiceList;
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
use Symfony\Component\Form\ChoiceList\View\ChoiceListView;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
class DefaultChoiceListFactoryTest extends TestCase
{
private $obj1;
private $obj2;
private $obj3;
private $obj4;
private $list;
/**
* @var DefaultChoiceListFactory
*/
private $factory;
public function getValue($object)
{
return $object->value;
}
public function getScalarValue($choice)
{
switch ($choice) {
case 'a': return 'a';
case 'b': return 'b';
case 'c': return '1';
case 'd': return '2';
}
}
public function getLabel($object)
{
return $object->label;
}
public function getFormIndex($object)
{
return $object->index;
}
public function isPreferred($object)
{
return $this->obj2 === $object || $this->obj3 === $object;
}
public function getAttr($object)
{
return $object->attr;
}
public function getGroup($object)
{
return $this->obj1 === $object || $this->obj2 === $object ? 'Group 1' : 'Group 2';
}
public function getGroupArray($object)
{
return $this->obj1 === $object || $this->obj2 === $object ? ['Group 1', 'Group 2'] : ['Group 3'];
}
public function getGroupAsObject($object)
{
return $this->obj1 === $object || $this->obj2 === $object
? new DefaultChoiceListFactoryTest_Castable('Group 1')
: new DefaultChoiceListFactoryTest_Castable('Group 2');
}
protected function setUp(): void
{
$this->obj1 = (object) ['label' => 'A', 'index' => 'w', 'value' => 'a', 'preferred' => false, 'group' => 'Group 1', 'attr' => []];
$this->obj2 = (object) ['label' => 'B', 'index' => 'x', 'value' => 'b', 'preferred' => true, 'group' => 'Group 1', 'attr' => ['attr1' => 'value1']];
$this->obj3 = (object) ['label' => 'C', 'index' => 'y', 'value' => 1, 'preferred' => true, 'group' => 'Group 2', 'attr' => ['attr2' => 'value2']];
$this->obj4 = (object) ['label' => 'D', 'index' => 'z', 'value' => 2, 'preferred' => false, 'group' => 'Group 2', 'attr' => []];
$this->list = new ArrayChoiceList(['A' => $this->obj1, 'B' => $this->obj2, 'C' => $this->obj3, 'D' => $this->obj4]);
$this->factory = new DefaultChoiceListFactory();
}
public function testCreateFromChoicesEmpty()
{
$list = $this->factory->createListFromChoices([]);
$this->assertSame([], $list->getChoices());
$this->assertSame([], $list->getValues());
}
public function testCreateFromChoicesFlat()
{
$list = $this->factory->createListFromChoices(['A' => $this->obj1, 'B' => $this->obj2, 'C' => $this->obj3, 'D' => $this->obj4]);
$this->assertObjectListWithGeneratedValues($list);
}
public function testCreateFromChoicesFlatTraversable()
{
$list = $this->factory->createListFromChoices(
new \ArrayIterator(['A' => $this->obj1, 'B' => $this->obj2, 'C' => $this->obj3, 'D' => $this->obj4])
);
$this->assertObjectListWithGeneratedValues($list);
}
public function testCreateFromChoicesFlatValuesAsCallable()
{
$list = $this->factory->createListFromChoices(
['A' => $this->obj1, 'B' => $this->obj2, 'C' => $this->obj3, 'D' => $this->obj4],
[$this, 'getValue']
);
$this->assertObjectListWithCustomValues($list);
}
public function testCreateFromChoicesFlatValuesAsClosure()
{
$list = $this->factory->createListFromChoices(
['A' => $this->obj1, 'B' => $this->obj2, 'C' => $this->obj3, 'D' => $this->obj4],
function ($object) { return $object->value; }
);
$this->assertObjectListWithCustomValues($list);
}
public function testCreateFromChoicesGrouped()
{
$list = $this->factory->createListFromChoices([
'Group 1' => ['A' => $this->obj1, 'B' => $this->obj2],
'Group 2' => ['C' => $this->obj3, 'D' => $this->obj4],
]);
$this->assertObjectListWithGeneratedValues($list);
}
public function testCreateFromChoicesGroupedTraversable()
{
$list = $this->factory->createListFromChoices(
new \ArrayIterator([
'Group 1' => ['A' => $this->obj1, 'B' => $this->obj2],
'Group 2' => ['C' => $this->obj3, 'D' => $this->obj4],
])
);
$this->assertObjectListWithGeneratedValues($list);
}
public function testCreateFromChoicesGroupedValuesAsCallable()
{
$list = $this->factory->createListFromChoices(
[
'Group 1' => ['A' => $this->obj1, 'B' => $this->obj2],
'Group 2' => ['C' => $this->obj3, 'D' => $this->obj4],
],
[$this, 'getValue']
);
$this->assertObjectListWithCustomValues($list);
}
public function testCreateFromChoicesGroupedValuesAsClosure()
{
$list = $this->factory->createListFromChoices(
[
'Group 1' => ['A' => $this->obj1, 'B' => $this->obj2],
'Group 2' => ['C' => $this->obj3, 'D' => $this->obj4],
],
function ($object) { return $object->value; }
);
$this->assertObjectListWithCustomValues($list);
}
public function testCreateFromLoader()
{
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
$list = $this->factory->createListFromLoader($loader);
$this->assertEquals(new LazyChoiceList($loader), $list);
}
public function testCreateFromLoaderWithValues()
{
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
$value = function () {};
$list = $this->factory->createListFromLoader($loader, $value);
$this->assertEquals(new LazyChoiceList($loader, $value), $list);
}
public function testCreateViewFlat()
{
$view = $this->factory->createView($this->list);
$this->assertEquals(new ChoiceListView(
[
0 => new ChoiceView($this->obj1, '0', 'A'),
1 => new ChoiceView($this->obj2, '1', 'B'),
2 => new ChoiceView($this->obj3, '2', 'C'),
3 => new ChoiceView($this->obj4, '3', 'D'),
], []
), $view);
}
public function testCreateViewFlatPreferredChoices()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3]
);
$this->assertFlatView($view);
}
public function testCreateViewFlatPreferredChoicesSameOrder()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj1, $this->obj4, $this->obj3]
);
$preferredLabels = array_map(static function (ChoiceView $view): string {
return $view->label;
}, $view->preferredChoices);
$this->assertSame(
[
1 => 'B',
0 => 'A',
3 => 'D',
2 => 'C',
],
$preferredLabels
);
}
public function testCreateViewFlatPreferredChoicesEmptyArray()
{
$view = $this->factory->createView(
$this->list,
[]
);
$this->assertEquals(new ChoiceListView(
[
0 => new ChoiceView($this->obj1, '0', 'A'),
1 => new ChoiceView($this->obj2, '1', 'B'),
2 => new ChoiceView($this->obj3, '2', 'C'),
3 => new ChoiceView($this->obj4, '3', 'D'),
], []
), $view);
}
public function testCreateViewFlatPreferredChoicesAsCallable()
{
$view = $this->factory->createView(
$this->list,
[$this, 'isPreferred']
);
$this->assertFlatView($view);
}
public function testCreateViewFlatPreferredChoicesAsClosure()
{
$obj2 = $this->obj2;
$obj3 = $this->obj3;
$view = $this->factory->createView(
$this->list,
function ($object) use ($obj2, $obj3) {
return $obj2 === $object || $obj3 === $object;
}
);
$this->assertFlatView($view);
}
public function testCreateViewFlatPreferredChoicesClosureReceivesKey()
{
$view = $this->factory->createView(
$this->list,
function ($object, $key) {
return 'B' === $key || 'C' === $key;
}
);
$this->assertFlatView($view);
}
public function testCreateViewFlatPreferredChoicesClosureReceivesValue()
{
$view = $this->factory->createView(
$this->list,
function ($object, $key, $value) {
return '1' === $value || '2' === $value;
}
);
$this->assertFlatView($view);
}
public function testCreateViewFlatLabelAsCallable()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
[$this, 'getLabel']
);
$this->assertFlatView($view);
}
public function testCreateViewFlatLabelAsClosure()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
function ($object) {
return $object->label;
}
);
$this->assertFlatView($view);
}
public function testCreateViewFlatLabelClosureReceivesKey()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
function ($object, $key) {
return $key;
}
);
$this->assertFlatView($view);
}
public function testCreateViewFlatLabelClosureReceivesValue()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
function ($object, $key, $value) {
switch ($value) {
case '0': return 'A';
case '1': return 'B';
case '2': return 'C';
case '3': return 'D';
}
}
);
$this->assertFlatView($view);
}
public function testCreateViewFlatIndexAsCallable()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
[$this, 'getFormIndex']
);
$this->assertFlatViewWithCustomIndices($view);
}
public function testCreateViewFlatIndexAsClosure()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
function ($object) {
return $object->index;
}
);
$this->assertFlatViewWithCustomIndices($view);
}
public function testCreateViewFlatIndexClosureReceivesKey()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
function ($object, $key) {
switch ($key) {
case 'A': return 'w';
case 'B': return 'x';
case 'C': return 'y';
case 'D': return 'z';
}
}
);
$this->assertFlatViewWithCustomIndices($view);
}
public function testCreateViewFlatIndexClosureReceivesValue()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
function ($object, $key, $value) {
switch ($value) {
case '0': return 'w';
case '1': return 'x';
case '2': return 'y';
case '3': return 'z';
}
}
);
$this->assertFlatViewWithCustomIndices($view);
}
public function testCreateViewFlatGroupByOriginalStructure()
{
$list = new ArrayChoiceList([
'Group 1' => ['A' => $this->obj1, 'B' => $this->obj2],
'Group 2' => ['C' => $this->obj3, 'D' => $this->obj4],
'Group empty' => [],
]);
$view = $this->factory->createView(
$list,
[$this->obj2, $this->obj3]
);
$this->assertGroupedView($view);
}
public function testCreateViewFlatGroupByEmpty()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
null, // index
null // group
);
$this->assertFlatView($view);
}
public function testCreateViewFlatGroupByAsCallable()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
null, // index
[$this, 'getGroup']
);
$this->assertGroupedView($view);
}
public function testCreateViewFlatGroupByAsCallableReturnsArray()
{
$view = $this->factory->createView(
$this->list,
[],
null, // label
null, // index
[$this, 'getGroupArray']
);
$this->assertGroupedViewWithChoiceDuplication($view);
}
public function testCreateViewFlatGroupByObjectThatCanBeCastToString()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
null, // index
[$this, 'getGroupAsObject']
);
$this->assertGroupedView($view);
}
public function testCreateViewFlatGroupByAsClosure()
{
$obj1 = $this->obj1;
$obj2 = $this->obj2;
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
null, // index
function ($object) use ($obj1, $obj2) {
return $obj1 === $object || $obj2 === $object ? 'Group 1' : 'Group 2';
}
);
$this->assertGroupedView($view);
}
public function testCreateViewFlatGroupByClosureReceivesKey()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
null, // index
function ($object, $key) {
return 'A' === $key || 'B' === $key ? 'Group 1' : 'Group 2';
}
);
$this->assertGroupedView($view);
}
public function testCreateViewFlatGroupByClosureReceivesValue()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
null, // index
function ($object, $key, $value) {
return '0' === $value || '1' === $value ? 'Group 1' : 'Group 2';
}
);
$this->assertGroupedView($view);
}
public function testCreateViewFlatAttrAsArray()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
null, // index
null, // group
[
'B' => ['attr1' => 'value1'],
'C' => ['attr2' => 'value2'],
]
);
$this->assertFlatViewWithAttr($view);
}
public function testCreateViewFlatAttrEmpty()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
null, // index
null, // group
[]
);
$this->assertFlatView($view);
}
public function testCreateViewFlatAttrAsCallable()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
null, // index
null, // group
[$this, 'getAttr']
);
$this->assertFlatViewWithAttr($view);
}
public function testCreateViewFlatAttrAsClosure()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
null, // index
null, // group
function ($object) {
return $object->attr;
}
);
$this->assertFlatViewWithAttr($view);
}
public function testCreateViewFlatAttrClosureReceivesKey()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
null, // index
null, // group
function ($object, $key) {
switch ($key) {
case 'B': return ['attr1' => 'value1'];
case 'C': return ['attr2' => 'value2'];
default: return [];
}
}
);
$this->assertFlatViewWithAttr($view);
}
public function testCreateViewFlatAttrClosureReceivesValue()
{
$view = $this->factory->createView(
$this->list,
[$this->obj2, $this->obj3],
null, // label
null, // index
null, // group
function ($object, $key, $value) {
switch ($value) {
case '1': return ['attr1' => 'value1'];
case '2': return ['attr2' => 'value2'];
default: return [];
}
}
);
$this->assertFlatViewWithAttr($view);
}
private function assertScalarListWithChoiceValues(ChoiceListInterface $list)
{
$this->assertSame(['a', 'b', 'c', 'd'], $list->getValues());
$this->assertSame([
'a' => 'a',
'b' => 'b',
'c' => 'c',
'd' => 'd',
], $list->getChoices());
$this->assertSame([
'a' => 'A',
'b' => 'B',
'c' => 'C',
'd' => 'D',
], $list->getOriginalKeys());
}
private function assertObjectListWithGeneratedValues(ChoiceListInterface $list)
{
$this->assertSame(['0', '1', '2', '3'], $list->getValues());
$this->assertSame([
0 => $this->obj1,
1 => $this->obj2,
2 => $this->obj3,
3 => $this->obj4,
], $list->getChoices());
$this->assertSame([
0 => 'A',
1 => 'B',
2 => 'C',
3 => 'D',
], $list->getOriginalKeys());
}
private function assertScalarListWithCustomValues(ChoiceListInterface $list)
{
$this->assertSame(['a', 'b', '1', '2'], $list->getValues());
$this->assertSame([
'a' => 'a',
'b' => 'b',
1 => 'c',
2 => 'd',
], $list->getChoices());
$this->assertSame([
'a' => 'A',
'b' => 'B',
1 => 'C',
2 => 'D',
], $list->getOriginalKeys());
}
private function assertObjectListWithCustomValues(ChoiceListInterface $list)
{
$this->assertSame(['a', 'b', '1', '2'], $list->getValues());
$this->assertSame([
'a' => $this->obj1,
'b' => $this->obj2,
1 => $this->obj3,
2 => $this->obj4,
], $list->getChoices());
$this->assertSame([
'a' => 'A',
'b' => 'B',
1 => 'C',
2 => 'D',
], $list->getOriginalKeys());
}
private function assertFlatView($view)
{
$this->assertEquals(new ChoiceListView(
[
0 => new ChoiceView($this->obj1, '0', 'A'),
1 => new ChoiceView($this->obj2, '1', 'B'),
2 => new ChoiceView($this->obj3, '2', 'C'),
3 => new ChoiceView($this->obj4, '3', 'D'),
], [
1 => new ChoiceView($this->obj2, '1', 'B'),
2 => new ChoiceView($this->obj3, '2', 'C'),
]
), $view);
}
private function assertFlatViewWithCustomIndices($view)
{
$this->assertEquals(new ChoiceListView(
[
'w' => new ChoiceView($this->obj1, '0', 'A'),
'x' => new ChoiceView($this->obj2, '1', 'B'),
'y' => new ChoiceView($this->obj3, '2', 'C'),
'z' => new ChoiceView($this->obj4, '3', 'D'),
], [
'x' => new ChoiceView($this->obj2, '1', 'B'),
'y' => new ChoiceView($this->obj3, '2', 'C'),
]
), $view);
}
private function assertFlatViewWithAttr($view)
{
$this->assertEquals(new ChoiceListView(
[
0 => new ChoiceView($this->obj1, '0', 'A'),
1 => new ChoiceView(
$this->obj2,
'1',
'B',
['attr1' => 'value1']
),
2 => new ChoiceView(
$this->obj3,
'2',
'C',
['attr2' => 'value2']
),
3 => new ChoiceView($this->obj4, '3', 'D'),
], [
1 => new ChoiceView(
$this->obj2,
'1',
'B',
['attr1' => 'value1']
),
2 => new ChoiceView(
$this->obj3,
'2',
'C',
['attr2' => 'value2']
),
]
), $view);
}
private function assertGroupedView($view)
{
$this->assertEquals(new ChoiceListView(
[
'Group 1' => new ChoiceGroupView(
'Group 1',
[
0 => new ChoiceView($this->obj1, '0', 'A'),
1 => new ChoiceView($this->obj2, '1', 'B'),
]
),
'Group 2' => new ChoiceGroupView(
'Group 2',
[
2 => new ChoiceView($this->obj3, '2', 'C'),
3 => new ChoiceView($this->obj4, '3', 'D'),
]
),
], [
'Group 1' => new ChoiceGroupView(
'Group 1',
[1 => new ChoiceView($this->obj2, '1', 'B')]
),
'Group 2' => new ChoiceGroupView(
'Group 2',
[2 => new ChoiceView($this->obj3, '2', 'C')]
),
]
), $view);
}
private function assertGroupedViewWithChoiceDuplication($view)
{
$this->assertEquals(new ChoiceListView(
[
'Group 1' => new ChoiceGroupView(
'Group 1',
[0 => new ChoiceView($this->obj1, '0', 'A'), 2 => new ChoiceView($this->obj2, '1', 'B')]
),
'Group 2' => new ChoiceGroupView(
'Group 2',
[1 => new ChoiceView($this->obj1, '0', 'A'), 3 => new ChoiceView($this->obj2, '1', 'B')]
),
'Group 3' => new ChoiceGroupView(
'Group 3',
[4 => new ChoiceView($this->obj3, '2', 'C'), 5 => new ChoiceView($this->obj4, '3', 'D')]
),
], []
), $view);
}
}
class DefaultChoiceListFactoryTest_Castable
{
private $property;
public function __construct($property)
{
$this->property = $property;
}
public function __toString(): string
{
return $this->property;
}
}