1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 12:54:05 +00:00

Fix filesystem bootstrapper (#7)

* Test if Storage::url() works correctly after reverting to central context

* Fix typo in code

* Access originalPaths using dot notation using `data_get()`
This commit is contained in:
lukinovec 2023-08-16 09:03:25 +02:00 committed by GitHub
parent 948754cadc
commit af3812e788
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -109,10 +109,10 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
$diskConfig = $this->app['config']['filesystems.disks.' . $diskName];
// Storage Url
$url = $this->originalPaths['disks.url.' . $diskName] ?? null;
$url = data_get($this->originalPaths, "disks.url.$diskName");
if ($diskConfig['driver'] === 'local' && ! is_null($url)) {
$$this->app['config']["filesystems.disks.$diskName.url"] = $url;
$this->app['config']["filesystems.disks.$diskName.url"] = $url;
}
}
}

View file

@ -298,6 +298,15 @@ test('files can get fetched using the storage url', function() {
$parsedUrl = Str::of($url)->after($hostname);
expect(file_get_contents(public_path($parsedUrl)))->toBe($tenantKey);
// Central
tenancy()->end();
Storage::disk('public')->put($centralFileName = 'central.txt', $centralFileContent = 'central');
pest()->artisan('storage:link');
$url = Storage::disk('public')->url($centralFileName);
expect(file_get_contents(public_path($url)))->toBe($centralFileContent);
});
test('create and delete storage symlinks jobs work', function() {