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

This adds support for tenancy aware Storage::url() method

This commit is contained in:
Martin Vlcek 2021-07-19 22:38:33 +00:00
parent 20e1fa1959
commit adf3daa022
7 changed files with 196 additions and 3 deletions

View file

@ -210,5 +210,32 @@ class BootstrapperTest extends TestCase
}
}
/** @test */
public function filesystem_local_storage_has_own_public_url()
{
config([
'tenancy.bootstrappers' => [
FilesystemTenancyBootstrapper::class,
],
'tenancy.filesystem.root_override.public' => '%storage_path%/app/public/',
'tenancy.filesystem.url_override.public' => 'storage-%tenant_id%'
]);
$tenant1 = Tenant::create();
$tenant2 = Tenant::create();
tenancy()->initialize($tenant1);
$this->assertEquals(
'http://localhost/storage-'.$tenant1->getTenantKey().'/',
Storage::disk('public')->url('')
);
tenancy()->initialize($tenant2);
$this->assertEquals(
'http://localhost/storage-'.$tenant2->getTenantKey().'/',
Storage::disk('public')->url('')
);
}
// for queues see QueueTest
}