예제 #1
0
 public function testGetDefaultOptions()
 {
     $type = new ModelHiddenType();
     $modelManager = $this->getMock('Sonata\\AdminBundle\\Model\\ModelManagerInterface');
     $optionResolver = new OptionsResolver();
     $type->setDefaultOptions($optionResolver);
     $options = $optionResolver->resolve(array('model_manager' => $modelManager, 'class' => '\\Foo'));
     $this->assertInstanceOf('Sonata\\AdminBundle\\Model\\ModelManagerInterface', $options['model_manager']);
     $this->assertSame($modelManager, $options['model_manager']);
     $this->assertSame('\\Foo', $options['class']);
 }
 public function testGetDefaultOptions()
 {
     $type = new ModelHiddenType();
     $modelManager = $this->getMock('Sonata\\AdminBundle\\Model\\ModelManagerInterface');
     $optionResolver = new OptionsResolver();
     if (!method_exists('Symfony\\Component\\Form\\AbstractType', 'getBlockPrefix')) {
         $type->setDefaultOptions($optionResolver);
     } else {
         $type->configureOptions($optionResolver);
     }
     $options = $optionResolver->resolve(array('model_manager' => $modelManager, 'class' => '\\Foo'));
     $this->assertInstanceOf('Sonata\\AdminBundle\\Model\\ModelManagerInterface', $options['model_manager']);
     $this->assertSame($modelManager, $options['model_manager']);
     $this->assertSame('\\Foo', $options['class']);
 }