Skip to content

Commit 3ef528c

Browse files
author
Daniel Kay
committed
test violation format when posting multiple extra fields
1 parent 7f69e5e commit 3ef528c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php

+21
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,27 @@ public function testViolationIfExtraData()
626626
->assertRaised();
627627
}
628628

629+
public function testViolationFormatIfMultipleExtraFields()
630+
{
631+
$form = $this->getBuilder('parent', null, array('extra_fields_message' => 'Extra!'))
632+
->setCompound(true)
633+
->setDataMapper($this->getDataMapper())
634+
->add($this->getBuilder('child'))
635+
->getForm();
636+
637+
$form->submit(array('foo' => 'bar', 'baz'=> 'qux', 'quux' => 'quuz'));
638+
639+
$this->expectNoValidate();
640+
641+
$this->validator->validate($form, new Form());
642+
643+
$this->buildViolation('Extra!')
644+
->setParameter('{{ extra_fields }}', '"foo", "baz", "quux"')
645+
->setInvalidValue(array('foo' => 'bar', 'baz'=> 'qux', 'quux' => 'quuz'))
646+
->setCode(Form::NO_SUCH_FIELD_ERROR)
647+
->assertRaised();
648+
}
649+
629650
public function testNoViolationIfAllowExtraData()
630651
{
631652
$context = $this->getMockExecutionContext();

0 commit comments

Comments
 (0)