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:
parent
f87c2b69ec
commit
5edf582269
2 changed files with 17 additions and 3 deletions
|
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue