mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 14:34:04 +00:00
simplify test: use concrete values instead of overly dynamic code
This commit is contained in:
parent
4f94ccb5f7
commit
354ec1fb2a
1 changed files with 5 additions and 7 deletions
|
|
@ -85,19 +85,17 @@ test('root url bootstrapper can be used with url generator bootstrapper', functi
|
|||
return true;
|
||||
})->name('tenant.home')->middleware(InitializeTenancyByPath::class);
|
||||
|
||||
$rootUrlOverride = function (Tenant $tenant, string $originalRootUrl) {
|
||||
return str($originalRootUrl)->beforeLast($tenant->getTenantKey())->toString() . '/' . $tenant->getTenantKey();
|
||||
$rootUrlOverride = function (Tenant $tenant) {
|
||||
return 'http://localhost/' . $tenant->getTenantKey();
|
||||
};
|
||||
|
||||
$tenant = Tenant::create();
|
||||
|
||||
$tenantUrl = $rootUrlOverride($tenant, url('/'));
|
||||
$tenant = Tenant::create(['id' => 'acme']);
|
||||
|
||||
RootUrlBootstrapper::$rootUrlOverride = $rootUrlOverride;
|
||||
|
||||
expect(route('home'))->toBe(url('/'));
|
||||
expect(route('home'))->toBe('http://localhost');
|
||||
|
||||
tenancy()->initialize($tenant);
|
||||
|
||||
expect(route('home'))->toBe($tenantUrl);
|
||||
expect(route('home'))->toBe('http://localhost/acme');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue