[Validator] phpize default option values
This makes the behavior for default constraints inline with the behavior when the option is given explicitly.
This commit is contained in:
parent
89d5ec002e
commit
d65679b302
@ -84,7 +84,7 @@ class XmlFileLoader extends FileLoader
|
||||
$options = array();
|
||||
}
|
||||
} elseif (strlen((string) $node) > 0) {
|
||||
$options = trim($node);
|
||||
$options = XmlUtils::phpize(trim($node));
|
||||
} else {
|
||||
$options = null;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ use Symfony\Component\Validator\Constraints\NotNull;
|
||||
use Symfony\Component\Validator\Constraints\Range;
|
||||
use Symfony\Component\Validator\Constraints\Regex;
|
||||
use Symfony\Component\Validator\Constraints\IsTrue;
|
||||
use Symfony\Component\Validator\Constraints\Traverse;
|
||||
use Symfony\Component\Validator\Exception\MappingException;
|
||||
use Symfony\Component\Validator\Mapping\ClassMetadata;
|
||||
use Symfony\Component\Validator\Mapping\Loader\XmlFileLoader;
|
||||
@ -57,6 +58,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
$expected->addConstraint(new Callback('validateMe'));
|
||||
$expected->addConstraint(new Callback('validateMeStatic'));
|
||||
$expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback')));
|
||||
$expected->addConstraint(new Traverse(false));
|
||||
$expected->addPropertyConstraint('firstName', new NotNull());
|
||||
$expected->addPropertyConstraint('firstName', new Range(array('min' => 3)));
|
||||
$expected->addPropertyConstraint('firstName', new Choice(array('A', 'B')));
|
||||
|
@ -31,6 +31,11 @@
|
||||
<value>callback</value>
|
||||
</constraint>
|
||||
|
||||
<!-- Traverse with boolean default option -->
|
||||
<constraint name="Traverse">
|
||||
false
|
||||
</constraint>
|
||||
|
||||
<!-- PROPERTY CONSTRAINTS -->
|
||||
|
||||
<property name="firstName">
|
||||
|
Reference in New Issue
Block a user