Skip to content

Commit

Permalink
ensure to expect no validation for the right reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jan 4, 2020
1 parent 8e9aafc commit 8d46f95
Showing 1 changed file with 25 additions and 0 deletions.
Expand Up @@ -133,7 +133,10 @@ public function testDontValidateIfParentWithoutValidConstraint()
$parent->add($form);

$form->setData($object);
$parent->submit([]);

$this->assertTrue($form->isSubmitted());
$this->assertTrue($form->isSynchronized());
$this->expectNoValidate();

$this->validator->validate($form, new Form());
Expand Down Expand Up @@ -188,10 +191,15 @@ public function testDontValidateIfNoValidationGroups()
'validation_groups' => [],
])
->setData($object)
->setCompound(true)
->setDataMapper(new PropertyPathMapper())
->getForm();

$form->setData($object);
$form->submit([]);

$this->assertTrue($form->isSubmitted());
$this->assertTrue($form->isSynchronized());
$this->expectNoValidate();

$this->validator->validate($form, new Form());
Expand All @@ -214,6 +222,8 @@ public function testDontValidateConstraintsIfNoValidationGroups()
// Launch transformer
$form->submit('foo');

$this->assertTrue($form->isSubmitted());
$this->assertTrue($form->isSynchronized());
$this->expectNoValidate();

$this->validator->validate($form, new Form());
Expand All @@ -236,6 +246,8 @@ public function testDontValidateChildConstraintsIfCallableNoValidationGroups()
$form->add($child);
$form->submit([]);

$this->assertTrue($form->isSubmitted());
$this->assertTrue($form->isSynchronized());
$this->expectNoValidate();

$this->validator->validate($form, new Form());
Expand Down Expand Up @@ -264,6 +276,8 @@ function () { throw new TransformationFailedException(); }
// Launch transformer
$form->submit('foo');

$this->assertTrue($form->isSubmitted());
$this->assertFalse($form->isSynchronized());
$this->expectNoValidate();

$this->validator->validate($form, new Form());
Expand Down Expand Up @@ -299,6 +313,8 @@ function () { throw new TransformationFailedException(); }
// Launch transformer
$form->submit('foo');

$this->assertTrue($form->isSubmitted());
$this->assertFalse($form->isSynchronized());
$this->expectNoValidate();

$this->validator->validate($form, new Form());
Expand Down Expand Up @@ -369,6 +385,8 @@ function () { throw new TransformationFailedException(); }
// Launch transformer
$form->submit(['child' => 'foo']);

$this->assertTrue($form->isSubmitted());
$this->assertFalse($form->isSynchronized());
$this->expectNoValidate();

$this->validator->validate($form, new Form());
Expand Down Expand Up @@ -574,7 +592,10 @@ public function testDontWalkScalars()
$form = $this->getBuilder()
->setData('scalar')
->getForm();
$form->submit('foo');

$this->assertTrue($form->isSubmitted());
$this->assertTrue($form->isSynchronized());
$this->expectNoValidate();

$this->validator->validate($form, new Form());
Expand All @@ -592,6 +613,8 @@ public function testViolationIfExtraData()

$form->submit(['foo' => 'bar']);

$this->assertTrue($form->isSubmitted());
$this->assertTrue($form->isSynchronized());
$this->expectNoValidate();

$this->validator->validate($form, new Form());
Expand All @@ -613,6 +636,8 @@ public function testViolationFormatIfMultipleExtraFields()

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

$this->assertTrue($form->isSubmitted());
$this->assertTrue($form->isSynchronized());
$this->expectNoValidate();

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

0 comments on commit 8d46f95

Please sign in to comment.