1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 16:34:04 +00:00

Fix skip-failing test

This commit is contained in:
lukinovec 2022-09-22 15:14:41 +02:00
parent dda3e36ad6
commit 726f769318

View file

@ -97,19 +97,16 @@ test('migrate command loads schema state', function () {
test('migrate command only throws exceptions if skip-failing is not passed', function() { test('migrate command only throws exceptions if skip-failing is not passed', function() {
Tenant::create(); Tenant::create();
Event::forget(TenantCreated::class); $tenantWithoutDatabase = Tenant::create(['id' => 'withoutdb']);
$databaseToDrop = $tenantWithoutDatabase->run(fn() => DB::connection()->getDatabaseName());
Tenant::create(['id' => 'withoutdb']); DB::statement('DROP DATABASE ' . $databaseToDrop);
Event::listen(TenantCreated::class, JobPipeline::make([CreateDatabase::class])->send(function (TenantCreated $event) {
return $event->tenant;
})->toListener());
Tenant::create(); 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"'))->toThrow(Exception::class);
expect(fn() => pest()->artisan('tenants:migrate --schema-path="tests/Etc/tenant-schema.dump" --skip-failing'))->not()->toThrow(Exception::class); expect(fn() => pest()->artisan('tenants:migrate --schema-path="tests/Etc/tenant-schema.dump" --skip-failing'))->not()->toThrow(Exception::class);
}); })->group('skipfailing');
test('dump command works', function () { test('dump command works', function () {
$tenant = Tenant::create(); $tenant = Tenant::create();