I’m trying to use the laravel-modules package and everything runs as expected - except the tests. The problem is have is, that when running a test in the console, the specific module service providers seems not to be loaded. With the consequenz, that within my tests i’m not able to use factories, seeders or routs defined in the specific module.Latter because the RouteServiceProvider seems not to be loaded within the testing environment.
For the problem with the factories i found a solution for me by add the following code to the setUp() in my BaseTestCase:
$modules = array_splice(scandir( __DIR__."/../Modules"));
foreach ($Modules as $module ){
app(Factory::class)->load('__DIR__."/../Modules/{$module}/Database/factories')
}
But for the problem with ServiceProviders i don't have an good solution til now. Does anyone know, what the problem could be and how to solve it?
Aucun commentaire:
Enregistrer un commentaire