mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 04:34:02 +00:00
Fix ArgumentCount exception on the TenantAssetsController when no $path is provided
This commit is contained in:
parent
db9480f54e
commit
0db972384a
2 changed files with 21 additions and 4 deletions
|
|
@ -15,7 +15,7 @@ class TenantAssetsController extends Controller
|
||||||
$this->middleware(static::$tenancyMiddleware);
|
$this->middleware(static::$tenancyMiddleware);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function asset($path)
|
public function asset($path = null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return response()->file(storage_path("app/public/$path"));
|
return response()->file(storage_path("app/public/$path"));
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,11 @@ class TenantAssetTest extends TestCase
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
config(['tenancy.bootstrappers' => [
|
config([
|
||||||
|
'tenancy.bootstrappers' => [
|
||||||
FilesystemTenancyBootstrapper::class,
|
FilesystemTenancyBootstrapper::class,
|
||||||
]]);
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
Event::listen(TenancyInitialized::class, BootstrapTenancy::class);
|
Event::listen(TenancyInitialized::class, BootstrapTenancy::class);
|
||||||
}
|
}
|
||||||
|
|
@ -126,4 +128,19 @@ class TenantAssetTest extends TestCase
|
||||||
|
|
||||||
$this->assertSame($original, asset('foo'));
|
$this->assertSame($original, asset('foo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_asset_controller_returns_a_404_when_no_path_is_provided()
|
||||||
|
{
|
||||||
|
TenantAssetsController::$tenancyMiddleware = InitializeTenancyByRequestData::class;
|
||||||
|
|
||||||
|
$tenant = Tenant::create();
|
||||||
|
|
||||||
|
tenancy()->initialize($tenant);
|
||||||
|
$response = $this->get(tenant_asset(null), [
|
||||||
|
'X-Tenant' => $tenant->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response->assertNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue