From 726f769318856f7682164e52cacfb7a4a2b29fca Mon Sep 17 00:00:00 2001 From: lukinovec Date: Thu, 22 Sep 2022 15:14:41 +0200 Subject: [PATCH] Fix skip-failing test --- tests/CommandsTest.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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();