From 354ec1fb2a16b7331ae85efea096a6603e80446a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Fri, 20 Dec 2024 03:55:10 +0100 Subject: [PATCH] simplify test: use concrete values instead of overly dynamic code --- tests/Bootstrappers/RootUrlBootstrapperTest.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/Bootstrappers/RootUrlBootstrapperTest.php b/tests/Bootstrappers/RootUrlBootstrapperTest.php index 91ab608d..9f9d3b2a 100644 --- a/tests/Bootstrappers/RootUrlBootstrapperTest.php +++ b/tests/Bootstrappers/RootUrlBootstrapperTest.php @@ -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'); });