true]); }); it('recovers from a legacy plaintext cache entry for a protected key', function () { $key = 'captcha.turnstile.secret'; $adminValue = 'admin-turnstile-secret'; $cc = new ConfigCache; $cc->k = $key; $cc->v = encrypt($adminValue); $cc->save(); Cache::put(ConfigCacheService::CACHE_KEY.$key, 'plaintext-secret', now()->addHours(12)); expect(ConfigCacheService::get($key))->toBe($adminValue); $raw = Cache::get(ConfigCacheService::CACHE_KEY.$key); expect($raw)->not->toBe('plaintext-secret'); expect(decrypt($raw))->toBe($adminValue); }); it('returns a properly encrypted protected cache entry unchanged', function () { $key = 'captcha.turnstile.secret'; $adminValue = 'admin-turnstile-secret'; Cache::put(ConfigCacheService::CACHE_KEY.$key, encrypt($adminValue), now()->addHours(12)); expect(ConfigCacheService::get($key))->toBe($adminValue); }); it('returns a non-protected cached value without decrypting', function () { $key = 'app.name'; Cache::put(ConfigCacheService::CACHE_KEY.$key, 'MyInstance', now()->addHours(12)); expect(ConfigCacheService::get($key))->toBe('MyInstance'); });