mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 20:54:04 +00:00
* Add and test Migrate command's skip-failing option * Improve naming * Move migration event dispatching inside try block * Change test name * Fix skip-failing test * Use QueryException instead of Exception * Correct TenantDatabaseDoesNotExistException import * Correct test * Check for the the testing env in DB bootstrapper * Correct the Migrate command * Fix code style (php-cs-fixer) * add docs todo * Add QueryException to the Migrat command try/catch * Return status codes in Migrate * Fix code style (php-cs-fixer) * Add test for not stopping tenants:migrate after the first failure * Update Migrate command * Fix code style (php-cs-fixer) * Fix code style (php-cs-fixer) * Use `getTenants()` * Use withtenantDatabases where needed * Add withTenantDatabases to test --------- Co-authored-by: PHP CS Fixer <phpcsfixer@example.com> Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
21 lines
526 B
PHP
21 lines
526 B
PHP
<?php
|
|
|
|
use Stancl\Tenancy\Tests\TestCase;
|
|
use Stancl\JobPipeline\JobPipeline;
|
|
use Illuminate\Support\Facades\Event;
|
|
use Stancl\Tenancy\Jobs\CreateDatabase;
|
|
use Stancl\Tenancy\Events\TenantCreated;
|
|
|
|
uses(TestCase::class)->in(__DIR__);
|
|
|
|
function pest(): TestCase
|
|
{
|
|
return Pest\TestSuite::getInstance()->test;
|
|
}
|
|
|
|
function withTenantDatabases()
|
|
{
|
|
Event::listen(TenantCreated::class, JobPipeline::make([CreateDatabase::class])->send(function (TenantCreated $event) {
|
|
return $event->tenant;
|
|
})->toListener());
|
|
}
|