Skip to content

Commit 8191541

Browse files
committed
Merge branch '2.8'
2 parents e5928f7 + fef28b2 commit 8191541

File tree

2 files changed

+35
-45
lines changed

2 files changed

+35
-45
lines changed

UPGRADE-3.0.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,24 @@ UPGRADE FROM 2.x to 3.0
132132
));
133133
```
134134

135+
* The option "`virtual`" was renamed to "`inherit_data`".
136+
137+
Before:
138+
139+
```php
140+
$builder->add('address', 'form', array(
141+
'virtual' => true,
142+
));
143+
```
144+
145+
After:
146+
147+
```php
148+
$builder->add('address', 'form', array(
149+
'inherit_data' => true,
150+
));
151+
```
152+
135153
* The method `AbstractType::setDefaultOptions(OptionsResolverInterface $resolver)` and
136154
`AbstractTypeExtension::setDefaultOptions(OptionsResolverInterface $resolver)` have been
137155
renamed. You should use `AbstractType::configureOptions(OptionsResolver $resolver)` and
@@ -213,24 +231,6 @@ UPGRADE FROM 2.x to 3.0
213231
});
214232
```
215233

216-
* The option "`virtual`" was renamed to "`inherit_data`".
217-
218-
Before:
219-
220-
```php
221-
$builder->add('address', 'form', array(
222-
'virtual' => true,
223-
));
224-
```
225-
226-
After:
227-
228-
```php
229-
$builder->add('address', 'form', array(
230-
'inherit_data' => true,
231-
));
232-
```
233-
234234
* The class `VirtualFormAwareIterator` was renamed to `InheritDataAwareIterator`.
235235

236236
Before:

src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php

+17-27
Original file line numberDiff line numberDiff line change
@@ -499,27 +499,28 @@ public function testFailIfSetAllowedTypesFromLazyOption()
499499
}
500500

501501
/**
502-
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
503-
* @expectedExceptionMessage The option "foo" with value 42 is expected to be of type "string", but is of type "integer".
502+
* @dataProvider provideInvalidTypes
504503
*/
505-
public function testResolveFailsIfInvalidType()
504+
public function testResolveFailsIfInvalidType($actualType, $allowedType, $exceptionMessage)
506505
{
507-
$this->resolver->setDefined('foo');
508-
$this->resolver->setAllowedTypes('foo', 'string');
509-
510-
$this->resolver->resolve(array('foo' => 42));
506+
$this->resolver->setDefined('option');
507+
$this->resolver->setAllowedTypes('option', $allowedType);
508+
$this->setExpectedException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException', $exceptionMessage);
509+
$this->resolver->resolve(array('option' => $actualType));
511510
}
512511

513-
/**
514-
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
515-
* @expectedExceptionMessage The option "foo" with value null is expected to be of type "string", but is of type "NULL".
516-
*/
517-
public function testResolveFailsIfInvalidTypeIsNull()
512+
public function provideInvalidTypes()
518513
{
519-
$this->resolver->setDefault('foo', null);
520-
$this->resolver->setAllowedTypes('foo', 'string');
521-
522-
$this->resolver->resolve();
514+
return array(
515+
array(true, 'string', 'The option "option" with value true is expected to be of type "string", but is of type "boolean".'),
516+
array(false, 'string', 'The option "option" with value false is expected to be of type "string", but is of type "boolean".'),
517+
array(fopen(__FILE__, 'r'), 'string', 'The option "option" with value resource is expected to be of type "string", but is of type "resource".'),
518+
array(array(), 'string', 'The option "option" with value array is expected to be of type "string", but is of type "array".'),
519+
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".'),
520+
array(42, 'string', 'The option "option" with value 42 is expected to be of type "string", but is of type "integer".'),
521+
array(null, 'string', 'The option "option" with value null is expected to be of type "string", but is of type "NULL".'),
522+
array('bar', '\stdClass', 'The option "option" with value "bar" is expected to be of type "\stdClass", but is of type "string".'),
523+
);
523524
}
524525

525526
public function testResolveSucceedsIfValidType()
@@ -550,17 +551,6 @@ public function testResolveSucceedsIfValidTypeMultiple()
550551
$this->assertNotEmpty($this->resolver->resolve());
551552
}
552553

553-
/**
554-
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
555-
*/
556-
public function testResolveFailsIfNotInstanceOfClass()
557-
{
558-
$this->resolver->setDefault('foo', 'bar');
559-
$this->resolver->setAllowedTypes('foo', '\stdClass');
560-
561-
$this->resolver->resolve();
562-
}
563-
564554
public function testResolveSucceedsIfInstanceOfClass()
565555
{
566556
$this->resolver->setDefault('foo', new \stdClass());

0 commit comments

Comments
 (0)