From dbb377df8b07dcd2bf190133d125744bd51cde79 Mon Sep 17 00:00:00 2001 From: "Wouter (wotta)" Date: Tue, 19 Aug 2025 10:10:29 +0200 Subject: [PATCH] feat: Adding new test --- .../src/Panels/Tenancy/ResolveTenantTest.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/src/Panels/Tenancy/ResolveTenantTest.php b/tests/src/Panels/Tenancy/ResolveTenantTest.php index e7236fa818..0edf979e3b 100644 --- a/tests/src/Panels/Tenancy/ResolveTenantTest.php +++ b/tests/src/Panels/Tenancy/ResolveTenantTest.php @@ -50,3 +50,23 @@ it('resolves the tenant correctly using domain', function (): void { $resolvedTenant = $panel->getTenant($team->getRouteKey()); expect($resolvedTenant)->toBeSameModel($team); }); + +it('resolves the tenant with custom path correctly from the route', function (): void { + $team = Team::factory()->create(); + + $panel = Filament::getPanel('tenancy'); + Filament::setCurrentPanel($panel); + Filament::setTenant($team); + + $routeName = 'filament.tenancy.resources.posts.index'; + $route = Route::getRoutes()->getByName($routeName); + + $request = Request::create(route($routeName, [ + 'tenant' => $team, + ])); + + $request->setRouteResolver(fn () => $route->bind($request)); + + $resolvedTenant = $panel->getTenant($team->getKey()); + expect($resolvedTenant)->toBeSameModel($team); +}); \ No newline at end of file