mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 10:54:04 +00:00
Initial draft
This commit is contained in:
parent
4ff82a950d
commit
5d7d208e2f
19 changed files with 376 additions and 186 deletions
|
|
@ -19,9 +19,8 @@ class DatabaseSchemaManagerTest extends TestCase
|
|||
'database.default' => 'pgsql',
|
||||
'database.connections.pgsql.database' => 'main',
|
||||
'database.connections.pgsql.schema' => 'public',
|
||||
'tenancy.database.based_on' => null,
|
||||
'tenancy.database.template_connection' => null,
|
||||
'tenancy.database.suffix' => '',
|
||||
'tenancy.database.separate_by' => 'schema',
|
||||
'tenancy.database_managers.pgsql' => \Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLSchemaManager::class,
|
||||
]);
|
||||
}
|
||||
|
|
@ -41,14 +40,14 @@ class DatabaseSchemaManagerTest extends TestCase
|
|||
}
|
||||
|
||||
/** @test */
|
||||
public function the_default_db_is_used_when_based_on_is_null()
|
||||
public function the_default_db_is_used_when_template_connection_is_null()
|
||||
{
|
||||
config(['database.default' => 'pgsql']);
|
||||
|
||||
$this->assertSame('pgsql', config('database.default'));
|
||||
config([
|
||||
'database.connections.pgsql.foo' => 'bar',
|
||||
'tenancy.database.based_on' => null,
|
||||
'tenancy.database.template_connection' => null,
|
||||
]);
|
||||
|
||||
tenancy()->init('test.localhost');
|
||||
|
|
@ -63,7 +62,7 @@ class DatabaseSchemaManagerTest extends TestCase
|
|||
$tenant = tenancy()->create(['schema.localhost']);
|
||||
tenancy()->init('schema.localhost');
|
||||
|
||||
$this->assertSame($tenant->getDatabaseName(), config('database.connections.' . config('database.default') . '.schema'));
|
||||
$this->assertSame($tenant->database()->getName(), config('database.connections.' . config('database.default') . '.schema'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue