I am using the Hyn/multi-tenant 5.6
package for multi tenant application support. My application is working fine, I can create tenants and they are running propperly.
The problem comes with testing. I want to setup an existing tenant for my testing purpose. But somehow the application can't create the correct routes during testing. In CreateApplication.php I'm setting the tenant used for testing. Which has website_id = 1
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
return $app;
}
public function setUp() : void{
parent::setUp();
$hostname = Hostname::find(1);
$website = Website::findOrFail($hostname->website_id);
$tenancy = app(Environment::class);
$tenancy->hostname($hostname);
Artisan::call('optimize:clear');
Artisan::call('tenancy:migrate:fresh', ['--website_id' => 1]);
Artisan::call('tenancy:db:seed',['--class' => 'TenantSeeder','--website_id' => 1]);
}
}
I found some similar problems by googling but none of their solutions worked for me: https://github.com/tenancy/multi-tenant/issues/584
All my routes are in my tenants.php
file and working. I am using the latest version of PHPUNIT.
The error I get is:
Symfony\Component\Routing\Exception\RouteNotFoundException : Route [new_anmeldung_single] not defined.
Aucun commentaire:
Enregistrer un commentaire