$this->obj1 =
(object) ['label' => 'A', 'index' => 'w', 'value' => 'a', 'preferred' => false, 'group' => 'Group 1', 'attr' =>
[], 'labelTranslationParameters' =>
[]];
$this->obj2 =
(object) ['label' => 'B', 'index' => 'x', 'value' => 'b', 'preferred' => true, 'group' => 'Group 1', 'attr' =>
['attr1' => 'value1'
], 'labelTranslationParameters' =>
[]];
$this->obj3 =
(object) ['label' => 'C', 'index' => 'y', 'value' => 1, 'preferred' => true, 'group' => 'Group 2', 'attr' =>
['attr2' => 'value2'
], 'labelTranslationParameters' =>
[]];
$this->obj4 =
(object) ['label' => 'D', 'index' => 'z', 'value' => 2, 'preferred' => false, 'group' => 'Group 2', 'attr' =>
[], 'labelTranslationParameters' =>
['%placeholder1%' => 'value1'
]];
$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);
}