$validator =
new DummyValidator($violation);
$listener =
new ValidationListener($validator,
new ViolationMapper());
$listener->
validateForm(new FormEvent($form, null
));
$this->
assertCount(1,
$form->
getErrors());
$this->
assertSame($violation,
$form->
getErrors()[0
]->
getCause());
} public function testMapViolationAllowsNonSyncIfInvalid() { $violation =
new ConstraintViolation($this->message,
$this->messageTemplate,
$this->params, null, 'data', null, null, FormConstraint::NOT_SYNCHRONIZED_ERROR,
new FormConstraint());
$form =
new SubmittedNotSynchronizedForm(new FormConfigBuilder('street', null,
new EventDispatcher()));
$validator =
new DummyValidator($violation);
$listener =
new ValidationListener($validator,
new ViolationMapper());
$listener->
validateForm(new FormEvent($form, null
));
$this->
assertCount(1,
$form->
getErrors());
$this->
assertSame($violation,
$form->
getErrors()[0
]->
getCause());
} public function testValidateIgnoresNonRoot() {