connection()->getName(); tenancy()->init(); tenancy()->disconnectDatabase(); $new_connection_name = app(\Illuminate\Database\DatabaseManager::class)->connection()->getName(); $this->assertSame($old_connection_name, $new_connection_name); $this->assertNotEquals('tenant', $new_connection_name); } /** @test */ public function db_name_is_prefixed_with_db_path_when_sqlite_is_used() { config(['database.connections.tenant.driver' => 'mysql']); app(DatabaseManager::class)->createTenantConnection('foodb', 'fooconn'); // make tenant not sqlite so that it has to detect sqlite from fooconn $this->assertSame(config('database.connections.fooconn.database'), database_path('foodb')); } }