/** * @param array $choiceListOptions * @param array $expectedChoices * @param boolean $expectTranslation * * @dataProvider setDefaultOptionsDataProvider */ public function testSetDefaultOptions(array $choiceListOptions, array $expectedChoices, $expectTranslation = false) { // prepare query builder option if (isset($choiceListOptions['query_builder'])) { $choiceListOptions['query_builder'] = $this->getQueryBuilderOption($choiceListOptions); $configuration = $this->ormConfiguration; $configuration->expects($this->once())->method('addCustomHydrationMode')->with(TranslationWalker::HYDRATE_OBJECT_TRANSLATION, 'Gedmo\\Translatable\\Hydrator\\ORM\\ObjectHydrator'); /** @var $query \PHPUnit_Framework_MockObject_MockObject */ $this->query->expects($this->once())->method('setHint')->with(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'); } $resolver = new OptionsResolver(); $this->type->setDefaultOptions($resolver); $result = $resolver->resolve($choiceListOptions); $this->assertInstanceOf('Symfony\\Component\\Form\\Extension\\Core\\ChoiceList\\ObjectChoiceList', $result['choice_list']); $this->assertEquals($expectedChoices, $result['choice_list']->getChoices()); }