diff --git a/tests/CommandsTest.php b/tests/CommandsTest.php index e860fbcc..3ed34300 100644 --- a/tests/CommandsTest.php +++ b/tests/CommandsTest.php @@ -97,19 +97,16 @@ test('migrate command loads schema state', function () { test('migrate command only throws exceptions if skip-failing is not passed', function() { Tenant::create(); - Event::forget(TenantCreated::class); + $tenantWithoutDatabase = Tenant::create(['id' => 'withoutdb']); + $databaseToDrop = $tenantWithoutDatabase->run(fn() => DB::connection()->getDatabaseName()); - Tenant::create(['id' => 'withoutdb']); - - Event::listen(TenantCreated::class, JobPipeline::make([CreateDatabase::class])->send(function (TenantCreated $event) { - return $event->tenant; - })->toListener()); + DB::statement('DROP DATABASE ' . $databaseToDrop); 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'); test('dump command works', function () { $tenant = Tenant::create();