From bd101797ea062a372726f3c76ba41f326e933876 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Wed, 26 Aug 2026 13:22:11 +0200 Subject: [PATCH] Correct and clarify the suffix appending comment in tenantScopedPath Also correct the terminology/wording in the related test. --- src/Bootstrappers/FilesystemTenancyBootstrapper.php | 3 ++- tests/Bootstrappers/FilesystemTenancyBootstrapperTest.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Bootstrappers/FilesystemTenancyBootstrapper.php b/src/Bootstrappers/FilesystemTenancyBootstrapper.php index 212cf9ac..57548d8d 100644 --- a/src/Bootstrappers/FilesystemTenancyBootstrapper.php +++ b/src/Bootstrappers/FilesystemTenancyBootstrapper.php @@ -250,7 +250,8 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper ->toString(); } - // Otherwise $configuredPath isn't necessarily storage_path()-based, so just append the suffix directly. + // Otherwise $configuredPath isn't necessarily storage_path()-based, so just append the + // suffix as a subdirectory, e.g. '/var/cache/foo' becomes '/var/cache/foo/tenant1'. return rtrim($configuredPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $suffix; } diff --git a/tests/Bootstrappers/FilesystemTenancyBootstrapperTest.php b/tests/Bootstrappers/FilesystemTenancyBootstrapperTest.php index 8f1a40d3..785ffbc3 100644 --- a/tests/Bootstrappers/FilesystemTenancyBootstrapperTest.php +++ b/tests/Bootstrappers/FilesystemTenancyBootstrapperTest.php @@ -571,7 +571,7 @@ test('a file cache store without a configured lock_path defaults to using its sc expect(File::isDirectory($path))->toBeTrue(); }); -test('a cache store using a path not based on storage_path() has the tenant suffix appended', function () { +test('a cache store using a path not based on storage_path() is scoped to a tenant subdirectory', function () { // tenantScopedPath() has no central storage path prefix to swap for the tenant's here, // so it appends the tenant suffix to $path instead. $path = '/tmp/tenancy-cache-test'; @@ -600,8 +600,8 @@ test('a cache store using a path not based on storage_path() has the tenant suff tenancy()->initialize($tenant1); expect(Cache::store('foo_file')->get('key'))->toBe('tenant1'); - // Tenant's 'foo_file' cache directory is created at $path with - // the tenant suffix appended, not at the tenant-scoped storage_path(). + // Tenant's 'foo_file' cache directory is created inside $path, + // not at the tenant-scoped storage_path(). expect(File::isDirectory("{$path}/tenant{$tenant1->id}"))->toBeTrue(); expect(File::isDirectory(storage_path('framework/cache/data')))->toBeFalse();