/**
  * @param array $choiceListOptions
  * @param array $expectedChoices
  * @param boolean $expectTranslation
  *
  * @dataProvider configureOptionsDataProvider
  */
 public function testSetDefaultOptions(array $choiceListOptions, array $expectedChoices, $expectTranslation = false)
 {
     $test = $this;
     // prepare query builder option
     if (isset($choiceListOptions['query_builder'])) {
         $choiceListOptions['query_builder'] = $this->getQueryBuilderOption($choiceListOptions);
     }
     // expectations for option resolver
     $expectedRequiredOptions = array('class');
     $optionsResolver = $this->getMockBuilder('Symfony\\Component\\OptionsResolver\\OptionsResolverInterface')->disableOriginalConstructor()->setMethods(array('setRequired', 'setDefaults'))->getMockForAbstractClass();
     $optionsResolver->expects($this->once())->method('setRequired')->with($expectedRequiredOptions);
     $optionsResolver->expects($this->once())->method('setDefaults')->will($this->returnCallback(function ($options) use($test, $choiceListOptions, $expectedChoices) {
         $test->assertNull($options['property']);
         $test->assertNull($options['query_builder']);
         $test->assertNull($options['choices']);
         $test->assertInstanceOf('\\Closure', $options['choice_list']);
         $test->assertChoiceList($options['choice_list'], $choiceListOptions, $expectedChoices);
     }));
     // expectation for translation hydrator and hint
     if ($expectTranslation) {
         /** @var $configuration \PHPUnit_Framework_MockObject_MockObject */
         $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 */
         $query = $this->getQueryBuilder()->getQuery();
         $query->expects($this->once())->method('setHint')->with(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
     }
     // test
     $this->type->configureOptions($optionsResolver);
 }
 /**
  * @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());
 }