mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 16:24:04 +00:00
add public connection() method to the Tenant DB manager interface
This commit is contained in:
parent
5d688e6e5d
commit
fe0a322b87
6 changed files with 34 additions and 17 deletions
|
|
@ -22,9 +22,7 @@ test('database can be created after tenant creation', function () {
|
|||
})->toListener());
|
||||
|
||||
$tenant = Tenant::create();
|
||||
|
||||
$manager = app(MySQLDatabaseManager::class);
|
||||
$manager->setConnection('mysql');
|
||||
$manager = $tenant->database()->manager();
|
||||
|
||||
expect($manager->databaseExists($tenant->database()->getName()))->toBeTrue();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Schema;
|
|||
use Illuminate\Support\Str;
|
||||
use Stancl\JobPipeline\JobPipeline;
|
||||
use Stancl\Tenancy\Bootstrappers\DatabaseTenancyBootstrapper;
|
||||
use Stancl\Tenancy\Database\Contracts\StatefulTenantDatabaseManager;
|
||||
use Stancl\Tenancy\Database\DatabaseManager;
|
||||
use Stancl\Tenancy\Events\TenancyEnded;
|
||||
use Stancl\Tenancy\Events\TenancyInitialized;
|
||||
|
|
@ -36,7 +37,10 @@ test('databases can be created and deleted', function ($driver, $databaseManager
|
|||
$name = 'db' . pest()->randomString();
|
||||
|
||||
$manager = app($databaseManager);
|
||||
$manager->setConnection($driver);
|
||||
|
||||
if ($manager instanceof StatefulTenantDatabaseManager) {
|
||||
$manager->setConnection($driver);
|
||||
}
|
||||
|
||||
expect($manager->databaseExists($name))->toBeFalse();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue