|
@@ -162,6 +162,9 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
|
|
|
$type->expects($this->any())
|
|
|
->method('getExtensions')
|
|
|
->will($this->returnValue(array()));
|
|
|
+ $type->expects($this->any())
|
|
|
+ ->method('getAllowedOptionValues')
|
|
|
+ ->will($this->returnValue(array()));
|
|
|
$type->expects($this->any())
|
|
|
->method('getDefaultOptions')
|
|
|
->will($this->returnValue(array(
|
|
@@ -186,6 +189,9 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
|
|
|
$type->expects($this->any())
|
|
|
->method('getExtensions')
|
|
|
->will($this->returnValue(array()));
|
|
|
+ $type->expects($this->any())
|
|
|
+ ->method('getAllowedOptionValues')
|
|
|
+ ->will($this->returnValue(array()));
|
|
|
$type->expects($this->any())
|
|
|
->method('getDefaultOptions')
|
|
|
->will($this->returnValue(array(
|
|
@@ -210,6 +216,9 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
|
|
|
$type->expects($this->any())
|
|
|
->method('getExtensions')
|
|
|
->will($this->returnValue(array()));
|
|
|
+ $type->expects($this->any())
|
|
|
+ ->method('getAllowedOptionValues')
|
|
|
+ ->will($this->returnValue(array()));
|
|
|
$type->expects($this->any())
|
|
|
->method('getDefaultOptions')
|
|
|
->will($this->returnValue(array(
|
|
@@ -234,6 +243,9 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
|
|
|
$type->expects($this->any())
|
|
|
->method('getExtensions')
|
|
|
->will($this->returnValue(array()));
|
|
|
+ $type->expects($this->any())
|
|
|
+ ->method('getAllowedOptionValues')
|
|
|
+ ->will($this->returnValue(array()));
|
|
|
$type->expects($this->any())
|
|
|
->method('getDefaultOptions')
|
|
|
->will($this->returnValue(array(
|
|
@@ -263,6 +275,31 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
|
|
|
));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @expectedException Symfony\Component\Form\Exception\CreationException
|
|
|
+ */
|
|
|
+ public function testCreateNamedBuilderExpectsOptionsToBeInValidRange()
|
|
|
+ {
|
|
|
+ $type = new FooType();
|
|
|
+ $this->extension1->addType($type);
|
|
|
+
|
|
|
+ $this->factory->createNamedBuilder('foo', 'bar', null, array(
|
|
|
+ 'a_or_b' => 'c',
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testCreateNamedBuilderAllowsExtensionsToExtendAllowedOptionValues()
|
|
|
+ {
|
|
|
+ $type = new FooType();
|
|
|
+ $this->extension1->addType($type);
|
|
|
+ $this->extension1->addTypeExtension(new FooTypeBarExtension());
|
|
|
+
|
|
|
+ // no exception this time
|
|
|
+ $this->factory->createNamedBuilder('foo', 'bar', null, array(
|
|
|
+ 'a_or_b' => 'c',
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
public function testCreateNamedBuilderAddsTypeInstances()
|
|
|
{
|
|
|
$type = new FooType();
|