$object =
(object) ['preferred_choice' => true, 'view_label' => 'foo', 'view_index' => 'key', 'view_group' => 'bar', 'view_attribute' =>
['baz' => 'foobar'
]];
$list =
new ArrayChoiceList([$object]);
$this->
assertEquals(['key' =>
new ChoiceView($object, '0', '0'
)],
$this->factory->
createView($list, null, null,
new PropertyPath('view_index'
))->choices
);
} public function testCreateViewGroupsAsPropertyPath() { $object =
(object) ['preferred_choice' => true, 'view_label' => 'foo', 'view_index' => 'key', 'view_group' => 'bar', 'view_attribute' =>
['baz' => 'foobar'
]];
$list =
new ArrayChoiceList([$object]);
$this->
assertEquals(['bar' =>
new ChoiceGroupView('bar',
[new ChoiceView($object, '0', '0'
)])],
$this->factory->
createView($list, null, null, null, 'view_group'
)->choices
);
} public function testCreateViewGroupsAsPropertyPathInstance() { $object =
(object) ['preferred_choice' => true, 'view_label' => 'foo', 'view_index' => 'key', 'view_group' => 'bar', 'view_attribute' =>
['baz' => 'foobar'
]];
$list =
new ArrayChoiceList([$object]);
$this->
assertEquals(['bar' =>
new ChoiceGroupView('bar',
[new ChoiceView($object, '0', '0'
)])],
$this->factory->
createView($list, null, null, null,
new PropertyPath('view_group'
))->choices
);
} // https://github.com/symfony/symfony/issues/5494