From 697ba6592b13bff9962d1100e1ba71f5e2aa79c9 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Mon, 13 Apr 2026 14:23:39 +0200 Subject: [PATCH] Correct log file cleanup --- .../LogTenancyBootstrapperTest.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/Bootstrappers/LogTenancyBootstrapperTest.php b/tests/Bootstrappers/LogTenancyBootstrapperTest.php index c1c2854b..dd530dfc 100644 --- a/tests/Bootstrappers/LogTenancyBootstrapperTest.php +++ b/tests/Bootstrappers/LogTenancyBootstrapperTest.php @@ -20,9 +20,12 @@ beforeEach(function () { ], ]); - @unlink(storage_path('logs/laravel.log')); - @unlink(storage_path('logs/laravel-' . now()->format('Y-m-d') . '.log')); - foreach (glob(storage_path('tenant*/logs/*.log')) ?: [] as $path) { + $logFiles = array_merge( + glob(storage_path('logs/*.log')) ?: [], + glob(storage_path('tenant*/logs/*.log')) ?: [] + ); + + foreach ($logFiles as $path) { @unlink($path); } @@ -38,9 +41,12 @@ afterEach(function () { LogTenancyBootstrapper::$channelOverrides = []; LogTenancyBootstrapper::$storagePathChannels = ['single', 'daily']; - @unlink(storage_path('logs/laravel.log')); - @unlink(storage_path('logs/laravel-' . now()->format('Y-m-d') . '.log')); - foreach (glob(storage_path('tenant*/logs/*.log')) ?: [] as $path) { + $logFiles = array_merge( + glob(storage_path('logs/*.log')) ?: [], + glob(storage_path('tenant*/logs/*.log')) ?: [] + ); + + foreach ($logFiles as $path) { @unlink($path); } });