mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 14:24:04 +00:00
Add regression test for makeConnectionConfig not working correctly with custom $path
In makeConnectionConfig, changing the $this->getPath($databaseName) line back to `$baseConfig['database'] = database_path($databaseName);` will make the added test fail.
This commit is contained in:
parent
7660ddd3ab
commit
26c161a940
1 changed files with 17 additions and 0 deletions
|
|
@ -644,6 +644,23 @@ test('sqlite database manager recognizes inmemory databases correctly', function
|
|||
expect($manager->isInMemory('_tenancy_inmemory_123?mode=memory&cache=shared'))->toBeFalse();
|
||||
});
|
||||
|
||||
test('sqlite database manager respects the configured path while making the database config', function () {
|
||||
config()->set([
|
||||
'tenancy.database.template_tenant_connection' => 'sqlite',
|
||||
]);
|
||||
|
||||
$tenant = Tenant::make([
|
||||
'tenancy_db_name' => 'tenant.sqlite',
|
||||
]);
|
||||
|
||||
// SQLiteDatabaseManager::$path is null, the database path is built using database_path()
|
||||
expect($tenant->database()->connection()['database'])->toBe(database_path('tenant.sqlite'));
|
||||
|
||||
SQLiteDatabaseManager::$path = $customPath = '/custom/path/';
|
||||
|
||||
expect($tenant->database()->connection()['database'])->toBe($customPath . 'tenant.sqlite');
|
||||
});
|
||||
|
||||
// Datasets
|
||||
dataset('database_managers', [
|
||||
['mysql', MySQLDatabaseManager::class],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue