mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 02:54:05 +00:00
Update TenantDatabaseManagerTest.php
This commit is contained in:
parent
a3addd38e7
commit
677b62cf05
1 changed files with 3 additions and 4 deletions
|
|
@ -99,21 +99,20 @@ test('the tenant connection is fully removed', function () {
|
||||||
Event::listen(TenancyEnded::class, RevertToCentralContext::class);
|
Event::listen(TenancyEnded::class, RevertToCentralContext::class);
|
||||||
|
|
||||||
$tenant = Tenant::create();
|
$tenant = Tenant::create();
|
||||||
$tenantHostConnectionName = config('tenancy.database.tenant_host_connection_name');
|
|
||||||
|
|
||||||
expect(array_keys(app('db')->getConnections()))->toBe(['central', $tenantHostConnectionName]);
|
expect(array_keys(app('db')->getConnections()))->toBe(['central', 'tenant_host_connection']);
|
||||||
pest()->assertArrayNotHasKey('tenant', config('database.connections'));
|
pest()->assertArrayNotHasKey('tenant', config('database.connections'));
|
||||||
|
|
||||||
tenancy()->initialize($tenant);
|
tenancy()->initialize($tenant);
|
||||||
|
|
||||||
createUsersTable();
|
createUsersTable();
|
||||||
|
|
||||||
expect(array_keys(app('db')->getConnections()))->toBe(['central', $tenantHostConnectionName, 'tenant']);
|
expect(array_keys(app('db')->getConnections()))->toBe(['central', 'tenant_host_connection', 'tenant']);
|
||||||
pest()->assertArrayHasKey('tenant', config('database.connections'));
|
pest()->assertArrayHasKey('tenant', config('database.connections'));
|
||||||
|
|
||||||
tenancy()->end();
|
tenancy()->end();
|
||||||
|
|
||||||
expect(array_keys(app('db')->getConnections()))->toBe(['central', $tenantHostConnectionName]);
|
expect(array_keys(app('db')->getConnections()))->toBe(['central', 'tenant_host_connection']);
|
||||||
expect(config('database.connections.tenant'))->toBeNull();
|
expect(config('database.connections.tenant'))->toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue