minor #35207 [Form] ensure to expect no validation for the right reasons (xabbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[Form] ensure to expect no validation for the right reasons

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

8d46f95f4c ensure to expect no validation for the right reasons
This commit is contained in:
Nicolas Grekas 2020-01-04 12:55:48 +01:00
commit 9392f76519

View File

@ -133,7 +133,10 @@ class FormValidatorTest extends ConstraintValidatorTestCase
$parent->add($form);
$form->setData($object);
$parent->submit([]);
$this->assertTrue($form->isSubmitted());
$this->assertTrue($form->isSynchronized());
$this->expectNoValidate();
$this->validator->validate($form, new Form());
@ -188,10 +191,15 @@ class FormValidatorTest extends ConstraintValidatorTestCase
'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());
@ -214,6 +222,8 @@ class FormValidatorTest extends ConstraintValidatorTestCase
// Launch transformer
$form->submit('foo');
$this->assertTrue($form->isSubmitted());
$this->assertTrue($form->isSynchronized());
$this->expectNoValidate();
$this->validator->validate($form, new Form());
@ -236,6 +246,8 @@ class FormValidatorTest extends ConstraintValidatorTestCase
$form->add($child);
$form->submit([]);
$this->assertTrue($form->isSubmitted());
$this->assertTrue($form->isSynchronized());
$this->expectNoValidate();
$this->validator->validate($form, new Form());
@ -264,6 +276,8 @@ class FormValidatorTest extends ConstraintValidatorTestCase
// Launch transformer
$form->submit('foo');
$this->assertTrue($form->isSubmitted());
$this->assertFalse($form->isSynchronized());
$this->expectNoValidate();
$this->validator->validate($form, new Form());
@ -299,6 +313,8 @@ class FormValidatorTest extends ConstraintValidatorTestCase
// Launch transformer
$form->submit('foo');
$this->assertTrue($form->isSubmitted());
$this->assertFalse($form->isSynchronized());
$this->expectNoValidate();
$this->validator->validate($form, new Form());
@ -369,6 +385,8 @@ class FormValidatorTest extends ConstraintValidatorTestCase
// Launch transformer
$form->submit(['child' => 'foo']);
$this->assertTrue($form->isSubmitted());
$this->assertFalse($form->isSynchronized());
$this->expectNoValidate();
$this->validator->validate($form, new Form());
@ -574,7 +592,10 @@ class FormValidatorTest extends ConstraintValidatorTestCase
$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());
@ -592,6 +613,8 @@ class FormValidatorTest extends ConstraintValidatorTestCase
$form->submit(['foo' => 'bar']);
$this->assertTrue($form->isSubmitted());
$this->assertTrue($form->isSynchronized());
$this->expectNoValidate();
$this->validator->validate($form, new Form());
@ -613,6 +636,8 @@ class FormValidatorTest extends ConstraintValidatorTestCase
$form->submit(['foo' => 'bar', 'baz' => 'qux', 'quux' => 'quuz']);
$this->assertTrue($form->isSubmitted());
$this->assertTrue($form->isSynchronized());
$this->expectNoValidate();
$this->validator->validate($form, new Form());