dimanche 26 avril 2020

Symfony, WebTestCase case, crashes because of a service not used in a test

I'm writing Symfony 4.3 phpunit funcional tests. And When I try to to launch the tests I get this error message:

Symfony\Component\DependencyInjection\Exception\RuntimeException: Cannot autowire service "fixtures class": argument "$encoder" of method "__construct()" references interface "Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface" but no such service exists. Did you create a class that implements this interface?

To clarify - I'm not using fixtures on these tests, but using data from the database. The use case is also defined correctly in the project (as, if I do anything, it works correctly).

This error pinpoint happens in my setUp() method on:

static::bootKernel();

Seems like the kernel somehow doesn't fetch all of the autowired services. (just a speculation)

Any suggestions?

Aucun commentaire:

Enregistrer un commentaire