8000 ensure to expect no validation for the right reasons · symfony/symfony@8d46f95 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8d46f95

Browse files
committed
ensure to expect no validation for the right reasons
1 parent 8e9aafc commit 8d46f95

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ public function testDontValidateIfParentWithoutValidConstraint()
133133
$parent->add($form);
134134

135135
$form->setData($object);
136+
$parent->submit([]);
136137

138+
$this->assertTrue($form->isSubmitted());
139+
$this->assertTrue($form->isSynchronized());
137140
$this->expectNoValidate();
138141

139142
$this->validator->validate($form, new Form());
@@ -188,10 +191,15 @@ public function testDontValidateIfNoValidationGroups()
188191
'validation_groups' => [],
189192
])
190193
->setData($object)
194+
->setCompound(true)
195+
->setDataMapper(new PropertyPathMapper())
191196
->getForm();
192197

193198
$form->setData($object);
199+
$form->submit([]);
194200

201+
$this->assertTrue($form->isSubmitted());
202+
$this->assertTrue($form->isSynchronized());
195203
$this->expectNoValidate();
196204

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

225+
$this->assertTrue($form->isSubmitted());
226+
$this->assertTrue($form->isSynchronized());
217227
$this->expectNoValidate();
218228

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

249+
$this->assertTrue($form->isSubmitted());
250+
$this->assertTrue($form->isSynchronized());
239251
$this->expectNoValidate();
240252

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

279+
$this->assertTrue($form->isSubmitted());
280+
$this->assertFalse($form->isSynchronized());
267281
$this->expectNoValidate();
268282

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

316+
$this->assertTrue($form->isSubmitted());
317+
$this->assertFalse($form->isSynchronized());
302318
$this->expectNoValidate();
303319

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

388+
$this->assertTrue($form->isSubmitted());
389+
$this->assertFalse($form->isSynchronized());
372390
$this->expectNoValidate();
373391

374392
$this->validator->validate($form, new Form());
@@ -574,7 +592,10 @@ public function testDontWalkScalars()
574592
$form = $this->getBuilder()
575593
->setData('scalar')
576594
->getForm();
595+
$form->submit('foo');
577596

597+
$this->assertTrue($form->isSubmitted());
598+
$this->assertTrue($form->isSynchronized());
578599
$this->expectNoValidate();
579600

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

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

616+
$this->assertTrue($form->isSubmitted());
617+
$this->assertTrue($form->isSynchronized());
595618
$this->expectNoValidate();
596619

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

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

639+
$this->assertTrue($form->isSubmitted());
640+
$this->assertTrue($form->isSynchronized());
616641
$this->expectNoValidate();
617642

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

0 commit comments

Comments
 (0)
0