From 9a2d3bdb80f6eb4412cb5426fff2671a9c52aa81 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Fri, 27 Dec 2024 09:02:32 +0100 Subject: [PATCH] Delete bootstrapper combining test --- .../Bootstrappers/RootUrlBootstrapperTest.php | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/tests/Bootstrappers/RootUrlBootstrapperTest.php b/tests/Bootstrappers/RootUrlBootstrapperTest.php index 2269d520..c25a8bae 100644 --- a/tests/Bootstrappers/RootUrlBootstrapperTest.php +++ b/tests/Bootstrappers/RootUrlBootstrapperTest.php @@ -70,42 +70,3 @@ test('root url bootstrapper overrides the root url when tenancy gets initialized expect(URL::to('/'))->toBe($baseUrl); expect(config('app.url'))->toBe($baseUrl); }); - -test('root url bootstrapper can be used with url generator bootstrapper', function() { - /** - * Order matters when combining these two bootstrappers. - * Before overriding the URL generator's root URL, we need to bind TenancyUrlGenerator. - * Otherwise (when using RootUrlBootstrapper BEFORE UrlGeneratorBootstrapper), - * the original URL generator's root URL will be changed, and only after that will the TenancyUrlGenerator bound, - * ultimately making the root URL override pointless. - */ - config(['tenancy.bootstrappers' => [UrlGeneratorBootstrapper::class, RootUrlBootstrapper::class]]); - - TenancyUrlGenerator::$prefixRouteNames = true; - TenancyUrlGenerator::$passTenantParameterToRoutes = true; - RootUrlBootstrapper::$rootUrlOverride = fn (Tenant $tenant, string $originalRootUrl) => $originalRootUrl . '/' . $tenant->getTenantKey(); - - Route::get('/home', fn () => 'home')->name('home'); - Route::get('/{tenant}/home', fn () => 'tenant.home')->name('tenant.home')->middleware(InitializeTenancyByPath::class); - - expect(url('/home'))->toBe('http://localhost/home'); - - expect(route('home'))->toBe('http://localhost/home'); - expect(route('home', absolute: false))->toBe('/home'); - - tenancy()->initialize(Tenant::create(['id' => 'acme'])); - - // The url() helper should generate the full URL containing the tenant key - expect(url('/home'))->toBe('http://localhost/acme/home'); - - /** - * The absolute path should return the correct absolute path, containing just one tenant key, - * and the relative path should still be /home. - * - * We use string manipulation in the route() method override for this to behave correctly. - * - * @see TenancyUrlGenerator - */ - expect(route('home'))->toBe('http://localhost/acme/home'); - expect(route('home', absolute: false))->toBe('/home'); -});