mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 23:34:03 +00:00
Null connection test
This commit is contained in:
parent
2f6f0e4d50
commit
65b2c6ceee
2 changed files with 17 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ return [
|
|||
'custom_columns' => [
|
||||
// 'plan',
|
||||
],
|
||||
'connection' => null, // todo verify this works
|
||||
'connection' => null,
|
||||
'table_names' => [
|
||||
'TenantModel' => 'tenants',
|
||||
'DomainModel' => 'domains',
|
||||
|
|
|
|||
|
|
@ -77,4 +77,20 @@ class TenancyBootstrappersTest extends TestCase
|
|||
$expected = [config('tenancy.cache.tag_base') . tenant('id'), 'foo', 'bar'];
|
||||
$this->assertEquals($expected, cache()->tags(['foo', 'bar'])->getTags()->getNames());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function the_default_db_connection_is_used_when_the_config_value_is_null()
|
||||
{
|
||||
$original = config('database.default');
|
||||
tenancy()->create(['foo.localhost']);
|
||||
tenancy()->init('foo.localhost');
|
||||
|
||||
$this->assertSame(null, config("database.connections.$original.foo"));
|
||||
|
||||
config(["database.connections.$original.foo" => 'bar']);
|
||||
tenancy()->create(['bar.localhost']);
|
||||
tenancy()->init('bar.localhost');
|
||||
|
||||
$this->assertSame('bar', config("database.connections.$original.foo"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue