79550621

Date: 2025-04-02 12:30:02
Score: 0.5
Natty:
Report link

So, after some more time/issues, I figured that my phpunit/phpunit bundle version was to old (9.*) and so I updated it to works with dama/doctrine-test-bundle (need phpunit version > 10).

But in the end, I removed dama/doctrine-test-bundle and used hautelook/alice-bundle.

I had to add this code in my /test/bootstrap.php to create the db and the schema.

$appKernel = new Kernel('test', false);
$appKernel->boot();

$application = new Application($appKernel);
$application->setCatchExceptions(false);
$application->setAutoExit(false);

$application->run(new ArrayInput([
    'command' => 'doctrine:database:drop',
    '--force' => '1',
]));

$application->run(new ArrayInput([
    'command' => 'doctrine:database:create',
]));

$application->run(new ArrayInput([
    'command' => 'doctrine:schema:create',
]));

$appKernel->shutdown();

And added use ReloadDatabaseTrait; at the beginning of my TestClass.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Dev Th