8000 Add failling test for group sequence · symfony/symfony@4850301 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4850301

Browse files
author
Benjamin Lazarecki
committed
Add failling test for group sequence
1 parent aa9c02c commit 4850301

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,31 @@ public function testValidateMultipleGroupsForAllConstraint()
11281128
$this->assertSame('Group bar', $violations[1]->getMessage());
11291129
}
11301130

1131+
public function testValidateGroupSequenceForCollectionConstraint()
1132+
{
1133+
$entity = new Entity();
1134+
$entity->firstName = array('baz' => 2);
1135+
1136+
$sequence = new GroupSequence(array('Entity', 'bar', 'foo'));
1137+
$this->metadata->setGroupSequence($sequence);
1138+
1139+
$this->metadata->addPropertyConstraint('firstName', new Collection(
1140+
array(
1141+
'fields' => array(
1142+
'baz' => array(
1143+
new Range(array('min' => 3, 'minMessage' => 'Group foo', 'groups' => 'foo')),
1144+
new Range(array('min' => 5, 'minMessage' => 'Group bar', 'groups' => 'bar')),
1145+
),
1146+
),
1147+
)
1148+
));
1149+
1150+
$violations = $this->validate($entity, null, 'Default');
1151+
1152+
$this->assertCount(1, $violations);
1153+
$this->assertSame('Group bar', $violations[0]->getMessage());
1154+
}
1155+
11311156
public function testReplaceDefaultGroupByGroupSequenceObject()
11321157
{
11331158
$entity = new Entity();

0 commit comments

Comments
 (0)
0