From a3addd38e728d4082b7e8f627d3c5b88347732b7 Mon Sep 17 00:00:00 2001 From: Abrar Ahmad Date: Tue, 27 Sep 2022 12:33:42 +0500 Subject: [PATCH] strict assertions --- tests/TenantDatabaseManagerTest.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/TenantDatabaseManagerTest.php b/tests/TenantDatabaseManagerTest.php index 387316be..9b99acf5 100644 --- a/tests/TenantDatabaseManagerTest.php +++ b/tests/TenantDatabaseManagerTest.php @@ -99,23 +99,22 @@ test('the tenant connection is fully removed', function () { Event::listen(TenancyEnded::class, RevertToCentralContext::class); $tenant = Tenant::create(); - - expect(array_keys(app('db')->getConnections()))->not()->toContain('tenant'); + $tenantHostConnectionName = config('tenancy.database.tenant_host_connection_name'); + + expect(array_keys(app('db')->getConnections()))->toBe(['central', $tenantHostConnectionName]); pest()->assertArrayNotHasKey('tenant', config('database.connections')); tenancy()->initialize($tenant); 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')); tenancy()->end(); - expect(array_keys(app('db')->getConnections())) - ->toContain('central') - ->not()->toContain('tenant') - ->and(config('database.connections.tenant'))->toBeNull(); + expect(array_keys(app('db')->getConnections()))->toBe(['central', $tenantHostConnectionName]); + expect(config('database.connections.tenant'))->toBeNull(); }); test('db name is prefixed with db path when sqlite is used', function () {