<?php

it('validates cached autoload paths before returning and clears stale cache entries', function (): void {
    $content = file_get_contents(app_path('index.php'));

    expect($content)->not->toBeFalse();
    expect($content)->toContain('$cache_key = \'autoload:\' . $class;');
    expect($content)->toContain('if (is_string($cached) && $cached !== \'\' && is_file($cached)) {');
    expect($content)->toContain('if ($is_loaded($class)) {');
    expect($content)->toContain('redis->delete($cache_key);');
});
