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

Add more TenantManager tests

This commit is contained in:
Samuel Štancl 2019-02-09 00:17:51 +01:00
parent 2c69c37032
commit 8d382024a3
3 changed files with 64 additions and 13 deletions

View file

@ -163,12 +163,6 @@ class TenantManager
return config('tenancy.database.prefix') . $tenant['uuid'] . config('tenancy.database.suffix');
}
public function getStoragePath($tenant = []): ?string
{
$tenant = $tenant ?: $this->tenant;
return config('tenancy.filesystem.suffix_base') . $tenant['uuid'];
}
public function setTenant(array $tenant): array
{
$this->tenant = $tenant;
@ -188,18 +182,19 @@ class TenantManager
return collect($this->storage->getAllTenants($uuids));
}
public function actAsId(string $uuid): array
/**
* Initialize tenancy based on tenant uuid.
*
* @param string $uuid
* @return array
*/
public function initById(string $uuid): array
{
$this->setTenant($this->storage->getTenantById($uuid));
$this->bootstrap();
return $this->tenant;
}
public function actAsDomain(string $domain): string
{
return $this->init($domain);
}
/**
* Get a value from the storage for a tenant.
*