mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 18:44:03 +00:00
strict assertions
This commit is contained in:
parent
8f7bb0c1a8
commit
a3addd38e7
1 changed files with 6 additions and 7 deletions
|
|
@ -99,23 +99,22 @@ 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()))->not()->toContain('tenant');
|
|
||||||
|
expect(array_keys(app('db')->getConnections()))->toBe(['central', $tenantHostConnectionName]);
|
||||||
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()))->toContain('central', 'tenant');
|
expect(array_keys(app('db')->getConnections()))->toBe(['central', $tenantHostConnectionName, 'tenant']);
|
||||||
pest()->assertArrayHasKey('tenant', config('database.connections'));
|
pest()->assertArrayHasKey('tenant', config('database.connections'));
|
||||||
|
|
||||||
tenancy()->end();
|
tenancy()->end();
|
||||||
|
|
||||||
expect(array_keys(app('db')->getConnections()))
|
expect(array_keys(app('db')->getConnections()))->toBe(['central', $tenantHostConnectionName]);
|
||||||
->toContain('central')
|
expect(config('database.connections.tenant'))->toBeNull();
|
||||||
->not()->toContain('tenant')
|
|
||||||
->and(config('database.connections.tenant'))->toBeNull();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('db name is prefixed with db path when sqlite is used', function () {
|
test('db name is prefixed with db path when sqlite is used', function () {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue