1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-09-20 12:34:03 +00:00

Correct and clarify the suffix appending comment in tenantScopedPath

Also correct the terminology/wording in the related test.
This commit is contained in:
lukinovec 2026-08-26 13:22:11 +02:00
parent 6ee058d166
commit bd101797ea
2 changed files with 5 additions and 4 deletions

View file

@ -250,7 +250,8 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
->toString(); ->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; return rtrim($configuredPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $suffix;
} }

View file

@ -571,7 +571,7 @@ test('a file cache store without a configured lock_path defaults to using its sc
expect(File::isDirectory($path))->toBeTrue(); 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, // tenantScopedPath() has no central storage path prefix to swap for the tenant's here,
// so it appends the tenant suffix to $path instead. // so it appends the tenant suffix to $path instead.
$path = '/tmp/tenancy-cache-test'; $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); tenancy()->initialize($tenant1);
expect(Cache::store('foo_file')->get('key'))->toBe('tenant1'); expect(Cache::store('foo_file')->get('key'))->toBe('tenant1');
// Tenant's 'foo_file' cache directory is created at $path with // Tenant's 'foo_file' cache directory is created inside $path,
// the tenant suffix appended, not at the tenant-scoped storage_path(). // not at the tenant-scoped storage_path().
expect(File::isDirectory("{$path}/tenant{$tenant1->id}"))->toBeTrue(); expect(File::isDirectory("{$path}/tenant{$tenant1->id}"))->toBeTrue();
expect(File::isDirectory(storage_path('framework/cache/data')))->toBeFalse(); expect(File::isDirectory(storage_path('framework/cache/data')))->toBeFalse();