1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 12:54:05 +00:00

Make DB storage driver prefix sqlite DBs with database_path()

This commit is contained in:
Samuel Štancl 2019-08-17 21:56:30 +02:00
parent f87c2b69ec
commit 5edf582269
2 changed files with 17 additions and 3 deletions

View file

@ -2,6 +2,8 @@
namespace Stancl\Tenancy\Tests;
use Stancl\Tenancy\DatabaseManager;
class DatabaseManagerTest extends TestCase
{
public $autoInitTenancy = false;
@ -17,4 +19,14 @@ class DatabaseManagerTest extends TestCase
$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'));
}
}