mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 20:54:03 +00:00
Update AutomaticModeTest.php
This commit is contained in:
parent
fa96555540
commit
acbdb4bbca
1 changed files with 7 additions and 12 deletions
|
|
@ -15,7 +15,8 @@ beforeEach(function () {
|
||||||
Event::listen(TenancyEnded::class, RevertToCentralContext::class);
|
Event::listen(TenancyEnded::class, RevertToCentralContext::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('context is switched when tenancy is initialized', function () {
|
function contextISSwitchedWhenTenancyInitialized()
|
||||||
|
{
|
||||||
config(['tenancy.bootstrappers' => [
|
config(['tenancy.bootstrappers' => [
|
||||||
MyBootstrapper::class,
|
MyBootstrapper::class,
|
||||||
]]);
|
]]);
|
||||||
|
|
@ -27,20 +28,14 @@ test('context is switched when tenancy is initialized', function () {
|
||||||
tenancy()->initialize($tenant);
|
tenancy()->initialize($tenant);
|
||||||
|
|
||||||
expect(app('tenancy_initialized_for_tenant'))->toBe('acme');
|
expect(app('tenancy_initialized_for_tenant'))->toBe('acme');
|
||||||
|
}
|
||||||
|
|
||||||
|
test('context is switched when tenancy is initialized', function () {
|
||||||
|
contextISSwitchedWhenTenancyInitialized();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('context is reverted when tenancy is ended', function () {
|
test('context is reverted when tenancy is ended', function () {
|
||||||
config(['tenancy.bootstrappers' => [
|
contextISSwitchedWhenTenancyInitialized();
|
||||||
MyBootstrapper::class,
|
|
||||||
]]);
|
|
||||||
|
|
||||||
$tenant = Tenant::create([
|
|
||||||
'id' => 'acme',
|
|
||||||
]);
|
|
||||||
|
|
||||||
tenancy()->initialize($tenant);
|
|
||||||
|
|
||||||
expect(app('tenancy_initialized_for_tenant'))->toBe('acme');
|
|
||||||
|
|
||||||
tenancy()->end();
|
tenancy()->end();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue