Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Validator] Fixed: Validator::validateValue() propagates empty valida…
…tion root instead of the provided value
  • Loading branch information
webmozart committed Jan 30, 2012
1 parent ce5cdad commit 1678a3d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/Validator.php
Expand Up @@ -108,7 +108,7 @@ public function validateValue($value, Constraint $constraint, $groups = null)
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)
Expand Down
11 changes: 9 additions & 2 deletions tests/Symfony/Tests/Component/Validator/ValidatorTest.php
Expand Up @@ -148,9 +148,16 @@ public function testValidatePropertyValue()

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()
Expand Down

0 comments on commit 1678a3d

Please sign in to comment.