I get my repository using entityManager, but if I try to access it in any way, it seems that the test starts endless cycle and then kills itself. It does not matter if I try to find an element inside or just print the whole variable the test just dies.
public function testStuff()
{
$moduleRepository = $this->entityManager->getRepository(Module::class);
fwrite(STDERR, print_r("asd", TRUE));
//$result = $moduleRepository->find(1);
fwrite(STDERR, print_r($moduleRepository, TRUE));
}
Output:
PHPUnit 9.5.5 by Sebastian Bergmann and contributors.
Testing
asdKilled
Without accessing the variable:
public function testStuff()
{
$moduleRepository = $this->entityManager->getRepository(Module::class);
fwrite(STDERR, print_r("asd", TRUE));
//$result = $moduleRepository->find(1);
//fwrite(STDERR, print_r($moduleRepository, TRUE));
}
Output:
PHPUnit 9.5.5 by Sebastian Bergmann and contributors.
Testing
asdmodule (App\Tests\module)
☢ Stuff
Time: 00:00.266, Memory: 22.00 MB
OK, but incomplete, skipped, or risky tests!
Tests: 1, Assertions: 0, Risky: 1.
I understand that by not calling the variable getRepository is not even started, but from the first test you can see that the method is done without any errors, the problem is only there when you try to access it.