This is all the familiar FormType Symfony
->add('assignedAgents', EntityType::class, [ 'label' => 'Agents', 'multiple' => true, 'required' => true, 'class' => 'Cirrus\UserBundle\Entity\User', 'property' => 'username', 'attr' => ['class' => 'select2'], 'query_builder' => function (EntityRepository $er) { return $er->createQueryBuilder('Usr') ->orderBy('Usr.username', 'ASC'); } ]) How to convert query_builder into a separate method so that the Coverage test can be written to 100% =)
There is a similar unanswered question https://stackoverflow.com/questions/29998640/unit-test-form-with-repository-method
@codeCoverageIgnoreStart/@codeCoverageIgnoreEnd? Then the lines would be considered complete. Read more here - BOPOH