app['router']->getRoutes(); $routes->refreshNameLookups(); $routes->refreshActionLookups(); CachedState::$cachedRoutes = $routes->compile(); } $this->markRoutesCached($this->app); } /** * Reset the route service provider so it's not defaulting to loading cached routes. * * This is helpful if some of the tests in the suite apply this trait while others do not. * * @return void */ protected function tearDownWithCachedRoutes(): void { RouteServiceProvider::loadCachedRoutesUsing(null); } /** * Inform the container to treat routes as cached. */ protected function markRoutesCached(Application $app): void { $app->instance('routes.cached', true); RouteServiceProvider::loadCachedRoutesUsing( static fn () => app('router')->setCompiledRoutes(CachedState::$cachedRoutes) ); } }