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

[4.x] Set app.url config in UrlTenancyBootstrapper (#1068)

* Set `app.url` config in UrlTenancyBootstrapper

* Add assertions

* Set base app URL in config

* Make UrlTenancyBootstrapper a singleton
This commit is contained in:
lukinovec 2023-02-18 13:01:17 +01:00 committed by GitHub
parent 617e9a7a73
commit fbdb13f392
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 8 deletions

View file

@ -396,6 +396,7 @@ test('url bootstrapper overrides the root url when tenancy gets initialized and
});
$baseUrl = url(route('home'));
config(['app.url' => $baseUrl]);
$rootUrlOverride = function (Tenant $tenant) use ($baseUrl) {
$scheme = str($baseUrl)->before('://');
@ -413,14 +414,17 @@ test('url bootstrapper overrides the root url when tenancy gets initialized and
expect(url(route('home')))->toBe($baseUrl);
expect(URL::to('/'))->toBe($baseUrl);
expect(config('app.url'))->toBe($baseUrl);
tenancy()->initialize($tenant);
expect(url(route('home')))->toBe($tenantUrl);
expect(URL::to('/'))->toBe($tenantUrl);
expect(config('app.url'))->toBe($tenantUrl);
tenancy()->end();
expect(url(route('home')))->toBe($baseUrl);
expect(URL::to('/'))->toBe($baseUrl);
expect(config('app.url'))->toBe($baseUrl);
});