From 15dc40839b6d8dcfb54c32a4f998784fb687e710 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Wed, 26 Oct 2022 12:08:14 +0200 Subject: [PATCH] Unlink tenant schema path before each test in CommandsTest (#986) * Add tenantSchemaPath method * Unlink tenant schema path before each test in CommandsTest * Remove the tenantSchemaPath helper --- tests/CommandsTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/CommandsTest.php b/tests/CommandsTest.php index 9a9f0bc5..ea973070 100644 --- a/tests/CommandsTest.php +++ b/tests/CommandsTest.php @@ -26,6 +26,10 @@ use Stancl\Tenancy\Bootstrappers\DatabaseTenancyBootstrapper; beforeEach(function () { + if (file_exists($schemaPath = database_path('schema/tenant-schema.dump'))) { + unlink($schemaPath); + } + Event::listen(TenantCreated::class, JobPipeline::make([CreateDatabase::class])->send(function (TenantCreated $event) { return $event->tenant; })->toListener()); @@ -131,7 +135,6 @@ test('tenant dump file gets created as tenant-schema.dump in the database schema Artisan::call('tenants:dump'); expect($schemaPath)->toBeFile(); - unlink($schemaPath); }); test('migrate command uses the correct schema path by default', function () {