[Form] Fixed regression in BooleanToStringTransformer from ed83752
This commit is contained in:
parent
610301d5e0
commit
2747bdca76
|
@ -49,6 +49,10 @@ class BooleanToStringTransformer implements DataTransformerInterface
|
|||
*/
|
||||
public function transform($value)
|
||||
{
|
||||
if (null === $value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!is_bool($value)) {
|
||||
throw new TransformationFailedException('Expected a Boolean.');
|
||||
}
|
||||
|
|
|
@ -38,12 +38,10 @@ class BooleanToStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertNull($this->transformer->transform(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
|
||||
*/
|
||||
public function testTransformFailsIfNull()
|
||||
// https://github.com/symfony/symfony/issues/8989
|
||||
public function testTransformAcceptsNull()
|
||||
{
|
||||
$this->transformer->transform(null);
|
||||
$this->assertNull($this->transformer->transform(null));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in New Issue