mardi 12 janvier 2021

How to run a functional test of a Symfony Command with Phpunit?

I want to make a functionnal test of a Symfony command through Phpunit.

I am already familiar with those tests on standards routes and controller but I need to test a full lifecycle of a critical command, with DB interaction and all.

Every example I've found make me use the Symfony CommandTester, which seems to need a manually instanciated command (so I lose all the DI). But I want to simulate what happen if I run bin/console app.my.command in my shell.

If I need another tool, I can consider that. But I would prefer stick to Phpunit.

Regards,

Aucun commentaire:

Enregistrer un commentaire