cache = new GeneralCache($inMemoryCache, $serializer); $this->compiledRoutes = new CompiledRoutes( staticRoutes: [ 'GET' => [ 'default' => [ '/home' => null, '/about' => null, ] ] ], dynamicPatterns: [ 'GET' => [ 'default' => null ] ], namedRoutes: [] ); $this->environment = new Environment([ 'APP_ENV' => 'testing', 'APP_DEBUG' => 'true', ]); }); it('has correct name', function () { $strategy = new CriticalPathWarmingStrategy( cache: $this->cache, compiledRoutes: $this->compiledRoutes, environment: $this->environment ); expect($strategy->getName())->toBe('critical_path'); }); it('has critical priority', function () { $strategy = new CriticalPathWarmingStrategy( cache: $this->cache, compiledRoutes: $this->compiledRoutes, environment: $this->environment ); expect($strategy->getPriority())->toBe(WarmupPriority::CRITICAL->value); }); it('always runs', function () { $strategy = new CriticalPathWarmingStrategy( cache: $this->cache, compiledRoutes: $this->compiledRoutes, environment: $this->environment ); expect($strategy->shouldRun())->toBeTrue(); }); it('warms routes cache', function () { $strategy = new CriticalPathWarmingStrategy( cache: $this->cache, compiledRoutes: $this->compiledRoutes, environment: $this->environment ); $result = $strategy->warmup(); // Strategy warms 4 items: routes_static, routes_stats, framework_config, env_variables expect($result->itemsWarmed)->toBe(4); expect($result->itemsFailed)->toBe(0); }); it('estimates reasonable duration', function () { $strategy = new CriticalPathWarmingStrategy( cache: $this->cache, compiledRoutes: $this->compiledRoutes, environment: $this->environment ); $duration = $strategy->getEstimatedDuration(); expect($duration)->toBeGreaterThan(0); expect($duration)->toBeLessThan(30); // Should be fast (< 30 seconds) }); });