cache = new CoreCacheDriver('array');
$this->app->instance(CacheInterface::class, $this->cache);
}
protected function tearDown(): void
{
Cache::flush();
parent::tearDown();
}
/**
* X-1: 모듈 설치 → 전체 캐시 카스케이드 무효화.
*
* 그룹 A(상태) + B(레이아웃) + C(SEO) 캐시가 한 번에 무효화되고,
* ext.cache_version 이 증가하는 시나리오를 키 차원에서 검증.
*/
#[Test]
public function x_1_module_install_cascades_all_groups(): void
{
// 초기 상태: 모든 그룹에 캐시 존재
$this->cache->put('ext.modules.active_identifiers', ['mod-a']); // A
$this->cache->put('ext.cache_version', 1000); // A
$this->cache->put('template.1.layout.admin/dashboard', 'merged'); // B
$this->cache->put('seo.page.abc123', '
'); // C
$this->cache->put('seo.config.sirsoft-admin_basic', ['v' => 1]); // C
$this->cache->put('seo.sitemap', ''); // C
// 모듈 설치 시 카스케이드 무효화 시뮬레이션
$this->cache->forget('ext.modules.active_identifiers'); // A: 상태 캐시
$this->cache->put('ext.cache_version', 2000); // A: 버전 증가
$this->cache->forget('template.1.layout.admin/dashboard'); // B: 레이아웃
$this->cache->forget('seo.page.abc123'); // C: SEO 페이지
$this->cache->forget('seo.config.sirsoft-admin_basic'); // C: SEO config
$this->cache->forget('seo.sitemap'); // C: Sitemap
// 모든 그룹 캐시 무효화 확인
$this->assertFalse($this->cache->has('ext.modules.active_identifiers'));
$this->assertSame(2000, $this->cache->get('ext.cache_version'));
$this->assertFalse($this->cache->has('template.1.layout.admin/dashboard'));
$this->assertFalse($this->cache->has('seo.page.abc123'));
$this->assertFalse($this->cache->has('seo.config.sirsoft-admin_basic'));
$this->assertFalse($this->cache->has('seo.sitemap'));
}
/**
* X-2: 설정 저장(SEO 탭) → 설정 + SEO 캐시 카스케이드.
*/
#[Test]
public function x_2_seo_settings_save_cascades_settings_and_seo(): void
{
$this->cache->put('settings.system', ['cached' => true]); // E
$this->cache->put('seo.page.abc', '