mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-04 17:04:03 +00:00
end() events
This commit is contained in:
parent
be84adffbf
commit
abda76a0f5
1 changed files with 38 additions and 0 deletions
|
|
@ -254,6 +254,7 @@ class TenantManagerTest extends TestCase
|
|||
}
|
||||
});
|
||||
|
||||
$this->assertSame(null, config('tenancy.foo'));
|
||||
tenancy()->init('foo.localhost');
|
||||
$this->assertSame('bar', config('tenancy.foo'));
|
||||
}
|
||||
|
|
@ -269,7 +270,44 @@ class TenantManagerTest extends TestCase
|
|||
}
|
||||
});
|
||||
|
||||
$this->assertSame(null, config('tenancy.foo'));
|
||||
tenancy()->init('foo.localhost');
|
||||
$this->assertSame('bar', config('tenancy.foo'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function ending_event_works()
|
||||
{
|
||||
$uuid = tenant()->create('foo.localhost')['uuid'];
|
||||
|
||||
Tenancy::ending(function ($tenantManager) use ($uuid) {
|
||||
if ($tenantManager->tenant['uuid'] === $uuid) {
|
||||
config(['tenancy.foo' => 'bar']);
|
||||
}
|
||||
});
|
||||
|
||||
$this->assertSame(null, config('tenancy.foo'));
|
||||
tenancy()->init('foo.localhost');
|
||||
$this->assertSame(null, config('tenancy.foo'));
|
||||
tenancy()->end();
|
||||
$this->assertSame('bar', config('tenancy.foo'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function ended_event_works()
|
||||
{
|
||||
$uuid = tenant()->create('foo.localhost')['uuid'];
|
||||
|
||||
Tenancy::ended(function ($tenantManager) use ($uuid) {
|
||||
if ($tenantManager->tenant['uuid'] === $uuid) {
|
||||
config(['tenancy.foo' => 'bar']);
|
||||
}
|
||||
});
|
||||
|
||||
$this->assertSame(null, config('tenancy.foo'));
|
||||
tenancy()->init('foo.localhost');
|
||||
$this->assertSame(null, config('tenancy.foo'));
|
||||
tenancy()->end();
|
||||
$this->assertSame('bar', config('tenancy.foo'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue