v7.0.0 release
This commit is contained in:
1 parent
0e7fa04b03
commit
c4ea9a6cd1
3582 files changed
+626189
-160151
No files matched your search
@@ -2,12 +2,13 @@
|
||||
|
||||
namespace Tests\Feature\Template;
|
||||
|
||||
use App\Contracts\Extension\CacheInterface;
|
||||
use App\Extension\Cache\CoreCacheDriver;
|
||||
use App\Extension\TemplateManager;
|
||||
use App\Extension\Traits\ClearsTemplateCaches;
|
||||
use App\Models\Template;
|
||||
use App\Models\TemplateLayout;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use App\Contracts\Extension\CacheInterface;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Tests\Helpers\ProtectsExtensionDirectories;
|
||||
@@ -49,6 +50,20 @@ class TemplateCacheManagementTest extends TestCase
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* 코어 캐시 드라이버를 반환합니다.
|
||||
*
|
||||
* 검증 대상 키(`template.*`, `layout.*`)는 모두 코어 소유이며
|
||||
* TemplateManager 가 CoreCacheDriver(`g7:core:` 네임스페이스)로 기록한다.
|
||||
* 컨테이너의 CacheInterface 바인딩은 선행 모듈/플러그인 테스트가
|
||||
* PluginCacheDriver 로 재바인딩할 수 있어 네임스페이스가 어긋날 수 있으므로,
|
||||
* 테스트도 프로덕션과 동일하게 CoreCacheDriver 로 조회한다.
|
||||
*/
|
||||
private function coreCache(): CacheInterface
|
||||
{
|
||||
return new CoreCacheDriver(config('cache.default', 'array'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 활성화 시 캐시 워밍 테스트
|
||||
*/
|
||||
@@ -77,7 +92,7 @@ class TemplateCacheManagementTest extends TestCase
|
||||
if ($layoutExists) {
|
||||
$cacheKey = "layout.sirsoft-admin_basic.{$layoutName}.v{$cacheVersion}";
|
||||
$this->assertTrue(
|
||||
app(CacheInterface::class)->get($cacheKey) !== null,
|
||||
$this->coreCache()->get($cacheKey) !== null,
|
||||
"활성화 후 {$layoutName} 레이아웃 캐시가 생성되어야 합니다."
|
||||
);
|
||||
}
|
||||
@@ -87,7 +102,7 @@ class TemplateCacheManagementTest extends TestCase
|
||||
$routesFile = base_path('templates/sirsoft-admin_basic/routes.json');
|
||||
if (file_exists($routesFile)) {
|
||||
$this->assertTrue(
|
||||
app(CacheInterface::class)->get("template.routes.sirsoft-admin_basic.v{$cacheVersion}") !== null,
|
||||
$this->coreCache()->get("template.routes.sirsoft-admin_basic.v{$cacheVersion}") !== null,
|
||||
'활성화 후 routes 캐시가 생성되어야 합니다.'
|
||||
);
|
||||
}
|
||||
@@ -98,7 +113,7 @@ class TemplateCacheManagementTest extends TestCase
|
||||
$langFile = base_path("templates/sirsoft-admin_basic/lang/{$locale}.json");
|
||||
if (file_exists($langFile)) {
|
||||
$this->assertTrue(
|
||||
app(CacheInterface::class)->get("template.language.sirsoft-admin_basic.{$locale}.v{$cacheVersion}") !== null,
|
||||
$this->coreCache()->get("template.language.sirsoft-admin_basic.{$locale}.v{$cacheVersion}") !== null,
|
||||
"활성화 후 {$locale} 다국어 캐시가 생성되어야 합니다."
|
||||
);
|
||||
}
|
||||
@@ -120,7 +135,7 @@ class TemplateCacheManagementTest extends TestCase
|
||||
|
||||
// 캐시가 존재하는지 확인 (버전 포함 키)
|
||||
$this->assertTrue(
|
||||
app(CacheInterface::class)->get("template.routes.sirsoft-admin_basic.v{$activateVersion}") !== null,
|
||||
$this->coreCache()->get("template.routes.sirsoft-admin_basic.v{$activateVersion}") !== null,
|
||||
'활성화 후 캐시가 존재해야 합니다.'
|
||||
);
|
||||
|
||||
@@ -152,7 +167,7 @@ class TemplateCacheManagementTest extends TestCase
|
||||
|
||||
// 캐시가 존재하는지 확인 (버전 포함 키)
|
||||
$this->assertTrue(
|
||||
app(CacheInterface::class)->get("template.routes.sirsoft-admin_basic.v{$firstVersion}") !== null,
|
||||
$this->coreCache()->get("template.routes.sirsoft-admin_basic.v{$firstVersion}") !== null,
|
||||
'첫 번째 템플릿 활성화 후 캐시가 존재해야 합니다.'
|
||||
);
|
||||
|
||||
@@ -165,7 +180,7 @@ class TemplateCacheManagementTest extends TestCase
|
||||
// deactivate → activate 시 캐시 버전이 증가하므로 새 버전으로 확인
|
||||
$newVersion = ClearsTemplateCaches::getExtensionCacheVersion();
|
||||
$this->assertTrue(
|
||||
app(CacheInterface::class)->get("template.routes.sirsoft-admin_basic.v{$newVersion}") !== null,
|
||||
$this->coreCache()->get("template.routes.sirsoft-admin_basic.v{$newVersion}") !== null,
|
||||
'재활성화 후 캐시가 다시 생성되어야 합니다.'
|
||||
);
|
||||
}
|
||||
@@ -185,7 +200,7 @@ class TemplateCacheManagementTest extends TestCase
|
||||
|
||||
// 캐시가 존재하는지 확인 (버전 포함 키)
|
||||
$this->assertTrue(
|
||||
app(CacheInterface::class)->get("template.routes.sirsoft-admin_basic.v{$activateVersion}") !== null,
|
||||
$this->coreCache()->get("template.routes.sirsoft-admin_basic.v{$activateVersion}") !== null,
|
||||
'활성화 후 캐시가 존재해야 합니다.'
|
||||
);
|
||||
|
||||
@@ -223,14 +238,14 @@ class TemplateCacheManagementTest extends TestCase
|
||||
|
||||
// 설치 시에는 캐시가 생성되지 않아야 함 (비활성 상태로 설치됨)
|
||||
$this->assertFalse(
|
||||
app(CacheInterface::class)->get("template.routes.sirsoft-admin_basic.v{$cacheVersion}") !== null,
|
||||
$this->coreCache()->get("template.routes.sirsoft-admin_basic.v{$cacheVersion}") !== null,
|
||||
'설치 시에는 routes 캐시가 생성되지 않아야 합니다 (비활성 상태).'
|
||||
);
|
||||
|
||||
$supportedLocales = config('app.supported_locales', ['ko', 'en']);
|
||||
foreach ($supportedLocales as $locale) {
|
||||
$this->assertFalse(
|
||||
app(CacheInterface::class)->get("template.language.sirsoft-admin_basic.{$locale}.v{$cacheVersion}") !== null,
|
||||
$this->coreCache()->get("template.language.sirsoft-admin_basic.{$locale}.v{$cacheVersion}") !== null,
|
||||
"설치 시에는 {$locale} 다국어 캐시가 생성되지 않아야 합니다."
|
||||
);
|
||||
}
|
||||
@@ -263,7 +278,7 @@ class TemplateCacheManagementTest extends TestCase
|
||||
foreach ($layouts as $layout) {
|
||||
$cacheKey = "g7:core:template.{$template->id}.layout.{$layout->name}";
|
||||
$this->assertFalse(
|
||||
app(CacheInterface::class)->get($cacheKey) !== null,
|
||||
$this->coreCache()->get($cacheKey) !== null,
|
||||
"비활성화 후 {$layout->name} 내부 레이아웃 캐시가 삭제되어야 합니다."
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user