[Validator] Fixed: Validator::validateValue() propagates empty validation root instead of the provided value
This commit is contained in:
parent
ce5cdaddea
commit
1678a3dbdf
@ -108,7 +108,7 @@ class Validator implements ValidatorInterface
|
|||||||
return $walker->walkConstraint($constraint, $value, $group, '');
|
return $walker->walkConstraint($constraint, $value, $group, '');
|
||||||
};
|
};
|
||||||
|
|
||||||
return $this->validateGraph($value, $walk, $groups);
|
return $this->validateGraph('', $walk, $groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function validateGraph($root, \Closure $walk, $groups = null)
|
protected function validateGraph($root, \Closure $walk, $groups = null)
|
||||||
|
@ -148,9 +148,16 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testValidateValue()
|
public function testValidateValue()
|
||||||
{
|
{
|
||||||
$result = $this->validator->validateValue('Bernhard', new FailingConstraint());
|
$violations = new ConstraintViolationList();
|
||||||
|
$violations->add(new ConstraintViolation(
|
||||||
|
'',
|
||||||
|
array(),
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'Bernhard'
|
||||||
|
));
|
||||||
|
|
||||||
$this->assertCount(1, $result);
|
$this->assertEquals($violations, $this->validator->validateValue('Bernhard', new FailingConstraint()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetMetadataFactory()
|
public function testGetMetadataFactory()
|
||||||
|
Reference in New Issue
Block a user