1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-16 00:24:04 +00:00

Fix some tests

This commit is contained in:
Samuel Štancl 2019-09-16 16:57:55 +02:00
parent a632b545b7
commit 1532ccf019
15 changed files with 121 additions and 118 deletions

View file

@ -32,13 +32,10 @@ class Run extends Command
*/
public function handle()
{
if ($tenancy_was_initialized = tenancy()->initialized) {
$previous_tenants_domain = tenant('domain');
}
tenant()->all($this->option('tenants'))->each(function ($tenant) {
$this->line("Tenant: {$tenant['id']} ({$tenant['domain']})");
tenancy()->init($tenant['domain']);
$originalTenant = tenancy()->getTenant();
tenancy()->all($this->option('tenants'))->each(function ($tenant) {
$this->line("Tenant: {$tenant['id']}");
tenancy()->initialize($tenant);
$callback = function ($prefix = '') {
return function ($arguments, $argument) use ($prefix) {
@ -58,11 +55,13 @@ class Run extends Command
// Run command
$this->call($this->argument('commandname'), \array_merge($arguments, $options));
tenancy()->end();
tenancy()->endTenancy();
});
if ($tenancy_was_initialized) {
tenancy()->init($previous_tenants_domain);
if ($originalTenant) {
tenancy()->initialize($originalTenant);
} else {
tenancy()->endTenancy();
}
}
}