mirror of
https://github.com/archtechx/tenancy.git
synced 2026-09-20 14:14:03 +00:00
Assert that TenantAssetController throws for scoped disks with a non-local parent
This commit is contained in:
parent
2cd514c781
commit
e20085588b
1 changed files with 12 additions and 4 deletions
|
|
@ -120,7 +120,7 @@ test('the disk used for serving tenant assets is configurable', function () {
|
|||
expect($response->getFile()->getPathname())->toBe($path);
|
||||
});
|
||||
|
||||
test('tenant asset controller throws when the configured disk is not local', function () {
|
||||
test('tenant asset controller throws when the configured disk is not local', function (string $publicDisk) {
|
||||
config([
|
||||
'tenancy.identification.default_middleware' => InitializeTenancyByRequestData::class,
|
||||
// Add a disk that uses the s3 driver (= non-local disk).
|
||||
|
|
@ -132,18 +132,26 @@ test('tenant asset controller throws when the configured disk is not local', fun
|
|||
'secret' => 'secret',
|
||||
'bucket' => 'bucket',
|
||||
],
|
||||
'filesystems.disks.scoped_remote' => [
|
||||
'driver' => 'scoped',
|
||||
'disk' => 'remote',
|
||||
'prefix' => 'assets',
|
||||
],
|
||||
]);
|
||||
|
||||
TenantAssetController::$publicDisk = 'remote';
|
||||
TenantAssetController::$publicDisk = $publicDisk;
|
||||
|
||||
$tenant = Tenant::create();
|
||||
tenancy()->initialize($tenant);
|
||||
|
||||
$this->withoutExceptionHandling();
|
||||
pest()->expectExceptionMessage('Disk [remote] is not a local disk.');
|
||||
pest()->expectExceptionMessage("Disk [$publicDisk] is not a local disk.");
|
||||
|
||||
pest()->get(tenant_asset('foo.txt'), ['X-Tenant' => $tenant->id]);
|
||||
});
|
||||
})->with([
|
||||
'disk' => 'remote',
|
||||
'scoped disk' => 'scoped_remote',
|
||||
]);
|
||||
|
||||
test('tenant asset controller throws when the disk used for serving assets is not tenant-aware', function (string $publicDisk, string $expectedMessage) {
|
||||
$centralStoragePath = storage_path();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue