Skip to content

Commit

Permalink
[2.6][Validator] Fix BC for Validator's validate method
Browse files Browse the repository at this point in the history
  • Loading branch information
michalmarcinkowski committed Jun 28, 2015
1 parent dda8303 commit 29ceaa2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Tests/Validator/Abstract2Dot5ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ public function testValidateConstraintWithoutGroup()
$this->assertCount(1, $violations);
}

public function testValidateWithEmptyArrayAsConstraint()
{
$violations = $this->validator->validate('value', array());
$this->assertCount(0, $violations);
}

public function testGroupSequenceAbortsAfterFailedGroup()
{
$entity = new Entity();
Expand Down
2 changes: 1 addition & 1 deletion Validator/LegacyValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getMetadataFactory()

private static function testConstraints($constraints)
{
return null === $constraints || $constraints instanceof Constraint || (is_array($constraints) && current($constraints) instanceof Constraint);
return null === $constraints || $constraints instanceof Constraint || (is_array($constraints) && (0 === count($constraints) || current($constraints) instanceof Constraint));
}

private static function testGroups($groups)
Expand Down

0 comments on commit 29ceaa2

Please sign in to comment.