mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 18:14:04 +00:00
Use QueryException instead of Exception
This commit is contained in:
parent
726f769318
commit
f505b7e1af
2 changed files with 6 additions and 5 deletions
|
|
@ -4,10 +4,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy\Commands;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Database\Console\Migrations\MigrateCommand;
|
||||
use Illuminate\Database\Migrations\Migrator;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Stancl\Tenancy\Concerns\DealsWithMigrations;
|
||||
use Stancl\Tenancy\Concerns\ExtendsLaravelCommand;
|
||||
use Stancl\Tenancy\Concerns\HasATenantsOption;
|
||||
|
|
@ -58,7 +58,7 @@ class Migrate extends MigrateCommand
|
|||
parent::handle();
|
||||
|
||||
event(new DatabaseMigrated($tenant));
|
||||
} catch (Exception $th) {
|
||||
} catch (QueryException $th) {
|
||||
if (! $this->option('skip-failing')) {
|
||||
throw $th;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Stancl\Tenancy\Tests\Etc\User;
|
||||
use Stancl\JobPipeline\JobPipeline;
|
||||
|
|
@ -104,9 +105,9 @@ test('migrate command only throws exceptions if skip-failing is not passed', fun
|
|||
|
||||
Tenant::create();
|
||||
|
||||
expect(fn() => pest()->artisan('tenants:migrate --schema-path="tests/Etc/tenant-schema.dump"'))->toThrow(Exception::class);
|
||||
expect(fn() => pest()->artisan('tenants:migrate --schema-path="tests/Etc/tenant-schema.dump" --skip-failing'))->not()->toThrow(Exception::class);
|
||||
})->group('skipfailing');
|
||||
expect(fn() => pest()->artisan('tenants:migrate --schema-path="tests/Etc/tenant-schema.dump"'))->toThrow(QueryException::class);
|
||||
expect(fn() => pest()->artisan('tenants:migrate --schema-path="tests/Etc/tenant-schema.dump" --skip-failing'))->not()->toThrow(QueryException::class);
|
||||
});
|
||||
|
||||
test('dump command works', function () {
|
||||
$tenant = Tenant::create();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue