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

Default to default DB

This commit is contained in:
Samuel Štancl 2019-08-17 21:25:53 +02:00
parent 29c8d5dab4
commit f87c2b69ec
2 changed files with 13 additions and 1 deletions

View file

@ -4,6 +4,7 @@ namespace Stancl\Tenancy\Tests;
use Stancl\Tenancy\StorageDrivers\RedisStorageDriver;
use Stancl\Tenancy\StorageDrivers\DatabaseStorageDriver;
use Stancl\Tenancy\Tenant;
class TenantStorageTest extends TestCase
{
@ -140,4 +141,15 @@ class TenantStorageTest extends TestCase
tenancy()->put('string', 'foo');
$this->assertSame('string', \gettype(tenancy()->get('string')));
}
/** @test */
public function tenant_model_uses_correct_connection()
{
config(['tenancy.storage.db.connection' => 'foo']);
$this->assertSame('foo', (new Tenant)->getConnectionName());
config(['tenancy.storage.db.connection' => null]);
config(['database.default' => 'foobar']);
$this->assertSame('foobar', (new Tenant)->getConnectionName());
}
}