mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 07:54:03 +00:00
Hardcode values instead of referencing variables
This commit is contained in:
parent
5e78d03ea4
commit
28adb5692d
1 changed files with 10 additions and 13 deletions
|
|
@ -387,18 +387,15 @@ function getDiskPrefix(string $disk): string
|
||||||
test('url bootstrapper overrides the root url when tenancy gets initialized and reverts the url to the central one after tenancy ends', function() {
|
test('url bootstrapper overrides the root url when tenancy gets initialized and reverts the url to the central one after tenancy ends', function() {
|
||||||
config(['tenancy.bootstrappers.url' => UrlTenancyBootstrapper::class]);
|
config(['tenancy.bootstrappers.url' => UrlTenancyBootstrapper::class]);
|
||||||
|
|
||||||
$routeName = 'home';
|
|
||||||
$routeUri = '/';
|
|
||||||
|
|
||||||
Route::group([
|
Route::group([
|
||||||
'middleware' => InitializeTenancyBySubdomain::class,
|
'middleware' => InitializeTenancyBySubdomain::class,
|
||||||
], function () use ($routeUri, $routeName) {
|
], function () {
|
||||||
Route::get($routeUri, function () {
|
Route::get('/', function () {
|
||||||
return true;
|
return true;
|
||||||
})->name($routeName);
|
})->name('home');
|
||||||
});
|
});
|
||||||
|
|
||||||
$baseUrl = url(route($routeName));
|
$baseUrl = url(route('home'));
|
||||||
|
|
||||||
$rootUrlOverride = function (Tenant $tenant) use ($baseUrl) {
|
$rootUrlOverride = function (Tenant $tenant) use ($baseUrl) {
|
||||||
$scheme = str($baseUrl)->before('://');
|
$scheme = str($baseUrl)->before('://');
|
||||||
|
|
@ -414,16 +411,16 @@ test('url bootstrapper overrides the root url when tenancy gets initialized and
|
||||||
|
|
||||||
expect($tenantUrl)->not()->toBe($baseUrl);
|
expect($tenantUrl)->not()->toBe($baseUrl);
|
||||||
|
|
||||||
expect(url(route($routeName)))->toBe($baseUrl);
|
expect(url(route('home')))->toBe($baseUrl);
|
||||||
expect(URL::to($routeUri))->toBe($baseUrl);
|
expect(URL::to('/'))->toBe($baseUrl);
|
||||||
|
|
||||||
tenancy()->initialize($tenant);
|
tenancy()->initialize($tenant);
|
||||||
|
|
||||||
expect(url(route($routeName)))->toBe($tenantUrl);
|
expect(url(route('home')))->toBe($tenantUrl);
|
||||||
expect(URL::to($routeUri))->toBe($tenantUrl);
|
expect(URL::to('/'))->toBe($tenantUrl);
|
||||||
|
|
||||||
tenancy()->end();
|
tenancy()->end();
|
||||||
|
|
||||||
expect(url(route($routeName)))->toBe($baseUrl);
|
expect(url(route('home')))->toBe($baseUrl);
|
||||||
expect(URL::to($routeUri))->toBe($baseUrl);
|
expect(URL::to('/'))->toBe($baseUrl);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue