mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 14:34:04 +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:
parent
948754cadc
commit
af3812e788
2 changed files with 11 additions and 2 deletions
|
|
@ -109,10 +109,10 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
|
||||||
$diskConfig = $this->app['config']['filesystems.disks.' . $diskName];
|
$diskConfig = $this->app['config']['filesystems.disks.' . $diskName];
|
||||||
|
|
||||||
// Storage Url
|
// Storage Url
|
||||||
$url = $this->originalPaths['disks.url.' . $diskName] ?? null;
|
$url = data_get($this->originalPaths, "disks.url.$diskName");
|
||||||
|
|
||||||
if ($diskConfig['driver'] === 'local' && ! is_null($url)) {
|
if ($diskConfig['driver'] === 'local' && ! is_null($url)) {
|
||||||
$$this->app['config']["filesystems.disks.$diskName.url"] = $url;
|
$this->app['config']["filesystems.disks.$diskName.url"] = $url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -298,6 +298,15 @@ test('files can get fetched using the storage url', function() {
|
||||||
$parsedUrl = Str::of($url)->after($hostname);
|
$parsedUrl = Str::of($url)->after($hostname);
|
||||||
|
|
||||||
expect(file_get_contents(public_path($parsedUrl)))->toBe($tenantKey);
|
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() {
|
test('create and delete storage symlinks jobs work', function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue