public function testCreateChoiceListWithGroupedChoices() { $choiceList =
new ArrayChoiceList([ 'Group 1' =>
['A' => 'a', 'B' => 'b'
],
'Group 2' =>
['C' => 'c', 'D' => 'd'
],
]);
$this->
assertSame(['a', 'b', 'c', 'd'
],
$choiceList->
getValues());
$this->
assertSame([ 'Group 1' =>
['A' => 'a', 'B' => 'b'
],
'Group 2' =>
['C' => 'c', 'D' => 'd'
],
],
$choiceList->
getStructuredValues());
$this->
assertSame(['a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd'
],
$choiceList->
getChoices());
$this->
assertSame(['a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D'
],
$choiceList->
getOriginalKeys());
$this->
assertSame([1 => 'a', 2 => 'b'
],
$choiceList->
getChoicesForValues([1 => 'a', 2 => 'b'
]));
$this->
assertSame([1 => 'a', 2 => 'b'
],
$choiceList->
getValuesForChoices([1 => 'a', 2 => 'b'
]));
} public function testCompareChoicesByIdentityByDefault() { $callback =
fn ($choice) =>
$choice->value;
$obj1 =
(object) ['value' => 'value1'
];