From c7db232f0cf0c99382eae415b410102be1897512 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Wed, 31 Aug 2022 09:24:51 +0200 Subject: [PATCH] Stop testing storage directory existence in symlink test --- tests/ActionTest.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/ActionTest.php b/tests/ActionTest.php index a1bd6a5c..dc7b2c56 100644 --- a/tests/ActionTest.php +++ b/tests/ActionTest.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Illuminate\Support\Facades\Event; -use Illuminate\Support\Facades\Storage; use Stancl\Tenancy\Events\TenancyEnded; use Stancl\Tenancy\Events\TenancyInitialized; use Stancl\Tenancy\Listeners\BootstrapTenancy; @@ -33,15 +32,12 @@ test('create storage symlinks action works', function() { tenancy()->initialize($tenant); - Storage::disk('public')->put('test.txt', 'test'); - - $this->assertDirectoryDoesNotExist(public_path("public-$tenantKey")); + $this->assertDirectoryDoesNotExist($publicPath = public_path("public-$tenantKey")); CreateStorageSymlinksAction::handle($tenant); - $this->assertDirectoryExists(storage_path("app/public")); - $this->assertDirectoryExists(public_path("public-$tenantKey")); - $this->assertEquals(storage_path("app/public/"), readlink(public_path("public-$tenantKey"))); + $this->assertDirectoryExists($publicPath); + $this->assertEquals(storage_path("app/public/"), readlink($publicPath)); }); test('remove storage symlinks action works', function() { @@ -62,7 +58,9 @@ test('remove storage symlinks action works', function() { CreateStorageSymlinksAction::handle($tenant); + $this->assertDirectoryExists($publicPath = public_path("public-$tenantKey")); + RemoveStorageSymlinksAction::handle($tenant); - $this->assertDirectoryDoesNotExist(public_path("public-$tenantKey")); + $this->assertDirectoryDoesNotExist($publicPath); });