Skip to content

Commit

Permalink
test violation format when posting multiple extra fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Kay committed Oct 17, 2018
1 parent 7f69e5e commit 3ef528c
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,27 @@ public function testViolationIfExtraData()
->assertRaised();
}

public function testViolationFormatIfMultipleExtraFields()
{
$form = $this->getBuilder('parent', null, array('extra_fields_message' => 'Extra!'))
->setCompound(true)
->setDataMapper($this->getDataMapper())
->add($this->getBuilder('child'))
->getForm();

$form->submit(array('foo' => 'bar', 'baz'=> 'qux', 'quux' => 'quuz'));

$this->expectNoValidate();

$this->validator->validate($form, new Form());

$this->buildViolation('Extra!')
->setParameter('{{ extra_fields }}', '"foo", "baz", "quux"')
->setInvalidValue(array('foo' => 'bar', 'baz'=> 'qux', 'quux' => 'quuz'))
->setCode(Form::NO_SUCH_FIELD_ERROR)
->assertRaised();
}

public function testNoViolationIfAllowExtraData()
{
$context = $this->getMockExecutionContext();
Expand Down

0 comments on commit 3ef528c

Please sign in to comment.