/** * @expectedException \RuntimeException */ public function testGetDefaultOptionsWithValidInvalidFlip() { Choice::$list = array(1 => 'error', 2 => 'error'); $type = new StatusType('Sonata\\CoreBundle\\Tests\\Form\\Type\\Choice', 'getList', 'choice_type', true); $this->assertEquals('choice_type', $type->getName()); $this->assertEquals('choice', $type->getParent()); FormHelper::configureOptions($type, $resolver = new OptionsResolver()); $options = $resolver->resolve(array()); }
public function testGetDefaultOptions() { $type = new StatusType('Sonata\\CoreBundle\\Tests\\Form\\Type\\Choice', 'getList', 'choice_type'); $this->assertEquals('choice_type', $type->getName()); $this->assertEquals('choice', $type->getParent()); FormHelper::configureOptions($type, $resolver = new OptionsResolver()); $options = $resolver->resolve(array()); $this->assertArrayHasKey('choices', $options); $this->assertEquals($options['choices'], array(1 => 'salut')); }