Merge branch '2.8'
This commit is contained in:
commit
819154127b
@ -132,6 +132,24 @@ UPGRADE FROM 2.x to 3.0
|
|||||||
));
|
));
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* The option "`virtual`" was renamed to "`inherit_data`".
|
||||||
|
|
||||||
|
Before:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$builder->add('address', 'form', array(
|
||||||
|
'virtual' => true,
|
||||||
|
));
|
||||||
|
```
|
||||||
|
|
||||||
|
After:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$builder->add('address', 'form', array(
|
||||||
|
'inherit_data' => true,
|
||||||
|
));
|
||||||
|
```
|
||||||
|
|
||||||
* The method `AbstractType::setDefaultOptions(OptionsResolverInterface $resolver)` and
|
* The method `AbstractType::setDefaultOptions(OptionsResolverInterface $resolver)` and
|
||||||
`AbstractTypeExtension::setDefaultOptions(OptionsResolverInterface $resolver)` have been
|
`AbstractTypeExtension::setDefaultOptions(OptionsResolverInterface $resolver)` have been
|
||||||
renamed. You should use `AbstractType::configureOptions(OptionsResolver $resolver)` and
|
renamed. You should use `AbstractType::configureOptions(OptionsResolver $resolver)` and
|
||||||
@ -213,24 +231,6 @@ UPGRADE FROM 2.x to 3.0
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
* The option "`virtual`" was renamed to "`inherit_data`".
|
|
||||||
|
|
||||||
Before:
|
|
||||||
|
|
||||||
```php
|
|
||||||
$builder->add('address', 'form', array(
|
|
||||||
'virtual' => true,
|
|
||||||
));
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
|
|
||||||
```php
|
|
||||||
$builder->add('address', 'form', array(
|
|
||||||
'inherit_data' => true,
|
|
||||||
));
|
|
||||||
```
|
|
||||||
|
|
||||||
* The class `VirtualFormAwareIterator` was renamed to `InheritDataAwareIterator`.
|
* The class `VirtualFormAwareIterator` was renamed to `InheritDataAwareIterator`.
|
||||||
|
|
||||||
Before:
|
Before:
|
||||||
|
@ -499,27 +499,28 @@ class OptionsResolverTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
|
* @dataProvider provideInvalidTypes
|
||||||
* @expectedExceptionMessage The option "foo" with value 42 is expected to be of type "string", but is of type "integer".
|
|
||||||
*/
|
*/
|
||||||
public function testResolveFailsIfInvalidType()
|
public function testResolveFailsIfInvalidType($actualType, $allowedType, $exceptionMessage)
|
||||||
{
|
{
|
||||||
$this->resolver->setDefined('foo');
|
$this->resolver->setDefined('option');
|
||||||
$this->resolver->setAllowedTypes('foo', 'string');
|
$this->resolver->setAllowedTypes('option', $allowedType);
|
||||||
|
$this->setExpectedException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException', $exceptionMessage);
|
||||||
$this->resolver->resolve(array('foo' => 42));
|
$this->resolver->resolve(array('option' => $actualType));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function provideInvalidTypes()
|
||||||
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
|
|
||||||
* @expectedExceptionMessage The option "foo" with value null is expected to be of type "string", but is of type "NULL".
|
|
||||||
*/
|
|
||||||
public function testResolveFailsIfInvalidTypeIsNull()
|
|
||||||
{
|
{
|
||||||
$this->resolver->setDefault('foo', null);
|
return array(
|
||||||
$this->resolver->setAllowedTypes('foo', 'string');
|
array(true, 'string', 'The option "option" with value true is expected to be of type "string", but is of type "boolean".'),
|
||||||
|
array(false, 'string', 'The option "option" with value false is expected to be of type "string", but is of type "boolean".'),
|
||||||
$this->resolver->resolve();
|
array(fopen(__FILE__, 'r'), 'string', 'The option "option" with value resource is expected to be of type "string", but is of type "resource".'),
|
||||||
|
array(array(), 'string', 'The option "option" with value array is expected to be of type "string", but is of type "array".'),
|
||||||
|
array(new OptionsResolver(), 'string', 'The option "option" with value Symfony\Component\OptionsResolver\OptionsResolver is expected to be of type "string", but is of type "Symfony\Component\OptionsResolver\OptionsResolver".'),
|
||||||
|
array(42, 'string', 'The option "option" with value 42 is expected to be of type "string", but is of type "integer".'),
|
||||||
|
array(null, 'string', 'The option "option" with value null is expected to be of type "string", but is of type "NULL".'),
|
||||||
|
array('bar', '\stdClass', 'The option "option" with value "bar" is expected to be of type "\stdClass", but is of type "string".'),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testResolveSucceedsIfValidType()
|
public function testResolveSucceedsIfValidType()
|
||||||
@ -550,17 +551,6 @@ class OptionsResolverTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertNotEmpty($this->resolver->resolve());
|
$this->assertNotEmpty($this->resolver->resolve());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
|
|
||||||
*/
|
|
||||||
public function testResolveFailsIfNotInstanceOfClass()
|
|
||||||
{
|
|
||||||
$this->resolver->setDefault('foo', 'bar');
|
|
||||||
$this->resolver->setAllowedTypes('foo', '\stdClass');
|
|
||||||
|
|
||||||
$this->resolver->resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testResolveSucceedsIfInstanceOfClass()
|
public function testResolveSucceedsIfInstanceOfClass()
|
||||||
{
|
{
|
||||||
$this->resolver->setDefault('foo', new \stdClass());
|
$this->resolver->setDefault('foo', new \stdClass());
|
||||||
|
Reference in New Issue
Block a user