use Symfony\Component\Form\FormErrorIterator;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Serializer\Normalizer\FormErrorNormalizer;
class FormErrorNormalizerTest extends TestCase
{ private FormErrorNormalizer
$normalizer;
private FormInterface
$form;
protected function setUp(): void
{ $this->normalizer =
new FormErrorNormalizer();
$this->form =
$this->
createMock(FormInterface::
class);
$this->form->
method('isSubmitted'
)->
willReturn(true
);
$this->form->
method('all'
)->
willReturn([]);
$this->form->
method('getErrors'
) ->
willReturn(new FormErrorIterator($this->form,
[ new FormError('a', 'b',
['c', 'd'
], 5, 'f'
),
new FormError(1, 2,
[3, 4
], 5, 6
),
]) );
}