1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 18:44:03 +00:00
The domain was wrapped in "".
This commit is contained in:
Samuel Štancl 2019-07-25 11:19:52 +02:00
parent 353f7afb82
commit 66a4fe9630
2 changed files with 19 additions and 1 deletions

View file

@ -53,10 +53,17 @@ class RedisStorageDriver implements StorageDriver
return $this->redis->hgetall("tenants:$uuid"); return $this->redis->hgetall("tenants:$uuid");
} }
/**
* @inheritDoc
*
* @param string $id
* @return boolean
* @todo Make tenant & domain deletion atomic.
*/
public function deleteTenant(string $id): bool public function deleteTenant(string $id): bool
{ {
try { try {
$domain = $this->getTenantById($id)['domain']; $domain = json_decode($this->getTenantById($id)['domain']);
} catch (\Throwable $th) { } catch (\Throwable $th) {
throw new \Exception("No tenant with UUID $id exists."); throw new \Exception("No tenant with UUID $id exists.");
} }

View file

@ -177,4 +177,15 @@ class TenantManagerTest extends TestCase
$this->assertSame($originals['storage_root'], Storage::disk('local')->getAdapter()->getPathPrefix()); $this->assertSame($originals['storage_root'], Storage::disk('local')->getAdapter()->getPathPrefix());
$this->assertSame($originals['cache'], app('cache')); $this->assertSame($originals['cache'], app('cache'));
} }
/** @test */
public function tenant_can_be_deleted()
{
$tenant = tenant()->create('foo.localhost');
tenant()->delete($tenant['uuid']);
$this->assertSame([], tenancy()->all()->toArray());
$tenant = tenant()->create('foo.localhost');
$this->assertSame([$tenant], tenancy()->all()->toArray());
}
} }