mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 17:24:03 +00:00
Bootstrapper tests
This commit is contained in:
parent
73fc525126
commit
6f4b9f486c
20 changed files with 266 additions and 79 deletions
|
|
@ -8,6 +8,7 @@ use Stancl\Tenancy\Contracts\TenancyBootstrapper;
|
|||
use Stancl\Tenancy\DatabaseManager;
|
||||
use Stancl\Tenancy\Exceptions\TenantDatabaseDoesNotExistException;
|
||||
use Stancl\Tenancy\Contracts\TenantWithDatabase;
|
||||
use Stancl\Tenancy\Contracts\Tenant;
|
||||
|
||||
class DatabaseTenancyBootstrapper implements TenancyBootstrapper
|
||||
{
|
||||
|
|
@ -19,8 +20,10 @@ class DatabaseTenancyBootstrapper implements TenancyBootstrapper
|
|||
$this->database = $database;
|
||||
}
|
||||
|
||||
public function start(TenantWithDatabase $tenant)
|
||||
public function start(Tenant $tenant)
|
||||
{
|
||||
/** @var TenantWithDatabase $tenant */
|
||||
|
||||
$database = $tenant->database()->getName();
|
||||
if (! $tenant->database()->manager()->databaseExists($database)) {
|
||||
throw new TenantDatabaseDoesNotExistException($database);
|
||||
|
|
@ -31,6 +34,6 @@ class DatabaseTenancyBootstrapper implements TenancyBootstrapper
|
|||
|
||||
public function end()
|
||||
{
|
||||
$this->database->revertToCentral();
|
||||
$this->database->reconnectToCentral();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue