v7.0.0 release
This commit is contained in:
1 parent
0e7fa04b03
commit
c4ea9a6cd1
3582 files changed
+626189
-160151
No files matched your search
@@ -5,6 +5,7 @@ namespace Tests\Feature\Services;
|
||||
use App\Contracts\Extension\ModuleManagerInterface;
|
||||
use App\Contracts\Extension\PluginManagerInterface;
|
||||
use App\Contracts\Extension\TemplateManagerInterface;
|
||||
use App\Contracts\Repositories\LayoutVersionRepositoryInterface;
|
||||
use App\Enums\ExtensionStatus;
|
||||
use App\Exceptions\TemplateFileCopyException;
|
||||
use App\Extension\HookManager;
|
||||
@@ -21,9 +22,13 @@ class TemplateServiceTest extends TestCase
|
||||
use RefreshDatabase;
|
||||
|
||||
private TemplateService $templateService;
|
||||
|
||||
private TemplateRepository $templateRepository;
|
||||
|
||||
private TemplateManagerInterface $templateManager;
|
||||
|
||||
private ModuleManagerInterface $moduleManager;
|
||||
|
||||
private PluginManagerInterface $pluginManager;
|
||||
|
||||
protected function setUp(): void
|
||||
@@ -43,14 +48,15 @@ class TemplateServiceTest extends TestCase
|
||||
$this->pluginManager = Mockery::mock(PluginManagerInterface::class);
|
||||
|
||||
// TemplateRepository 인스턴스 생성
|
||||
$this->templateRepository = new TemplateRepository();
|
||||
$this->templateRepository = new TemplateRepository;
|
||||
|
||||
// TemplateService 인스턴스 생성 (Mock Manager 주입)
|
||||
$this->templateService = new TemplateService(
|
||||
$this->templateRepository,
|
||||
$this->templateManager,
|
||||
$this->moduleManager,
|
||||
$this->pluginManager
|
||||
$this->pluginManager,
|
||||
app(LayoutVersionRepositoryInterface::class)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -66,7 +72,7 @@ class TemplateServiceTest extends TestCase
|
||||
public function test_activates_template_with_hook_system(): void
|
||||
{
|
||||
// Arrange - 고유 identifier 사용하여 트랜잭션 락 충돌 방지
|
||||
$identifier = 'test-template-' . uniqid();
|
||||
$identifier = 'test-template-'.uniqid();
|
||||
$template = Template::create([
|
||||
'identifier' => $identifier,
|
||||
'vendor' => 'test-vendor',
|
||||
@@ -104,6 +110,7 @@ class TemplateServiceTest extends TestCase
|
||||
->andReturnUsing(function () use ($template, $templateInfo) {
|
||||
// Manager가 DB 업데이트 시뮬레이션
|
||||
$template->update(['status' => ExtensionStatus::Active->value]);
|
||||
|
||||
return $templateInfo; // 배열 반환 (인터페이스 요구사항)
|
||||
});
|
||||
|
||||
@@ -122,13 +129,13 @@ class TemplateServiceTest extends TestCase
|
||||
$this->assertGreaterThanOrEqual(2, count($hookCalls));
|
||||
|
||||
// before_activate가 호출되었는지 확인
|
||||
$beforeActivateCalls = array_filter($hookCalls, fn($call) => $call['hook'] === 'before_activate');
|
||||
$beforeActivateCalls = array_filter($hookCalls, fn ($call) => $call['hook'] === 'before_activate');
|
||||
$this->assertNotEmpty($beforeActivateCalls);
|
||||
$firstBeforeActivate = array_values($beforeActivateCalls)[0];
|
||||
$this->assertEquals($template->identifier, $firstBeforeActivate['identifier']);
|
||||
|
||||
// after_activate가 호출되었는지 확인
|
||||
$afterActivateCalls = array_filter($hookCalls, fn($call) => $call['hook'] === 'after_activate');
|
||||
$afterActivateCalls = array_filter($hookCalls, fn ($call) => $call['hook'] === 'after_activate');
|
||||
$this->assertNotEmpty($afterActivateCalls);
|
||||
$firstAfterActivate = array_values($afterActivateCalls)[0];
|
||||
$this->assertEquals($template->id, $firstAfterActivate['template_id']);
|
||||
@@ -145,7 +152,7 @@ class TemplateServiceTest extends TestCase
|
||||
public function test_delegates_file_copy_to_manager(): void
|
||||
{
|
||||
// Arrange - 고유 identifier 사용하여 트랜잭션 락 충돌 방지
|
||||
$identifier = 'test-template-' . uniqid();
|
||||
$identifier = 'test-template-'.uniqid();
|
||||
$template = Template::create([
|
||||
'identifier' => $identifier,
|
||||
'vendor' => 'test-vendor',
|
||||
@@ -170,6 +177,7 @@ class TemplateServiceTest extends TestCase
|
||||
->with($identifier, false)
|
||||
->andReturnUsing(function () use ($template, $templateInfo) {
|
||||
$template->update(['status' => ExtensionStatus::Active->value]);
|
||||
|
||||
return $templateInfo; // 배열 반환 (인터페이스 요구사항)
|
||||
});
|
||||
|
||||
@@ -194,7 +202,7 @@ class TemplateServiceTest extends TestCase
|
||||
public function test_applies_filter_hook_before_manager_call(): void
|
||||
{
|
||||
// Arrange - 고유 identifier 사용하여 트랜잭션 락 충돌 방지
|
||||
$identifier = 'test-template-' . uniqid();
|
||||
$identifier = 'test-template-'.uniqid();
|
||||
$template = Template::create([
|
||||
'identifier' => $identifier,
|
||||
'vendor' => 'test-vendor',
|
||||
@@ -217,6 +225,7 @@ class TemplateServiceTest extends TestCase
|
||||
HookManager::addFilter('core.templates.filter_activate_data', function ($data, $template) use (&$filterApplied) {
|
||||
$filterApplied = true;
|
||||
$data['custom_field'] = 'filtered_value';
|
||||
|
||||
return $data;
|
||||
}, 10, 2);
|
||||
|
||||
@@ -227,6 +236,7 @@ class TemplateServiceTest extends TestCase
|
||||
->with($identifier, false)
|
||||
->andReturnUsing(function () use ($template, $templateInfo) {
|
||||
$template->update(['status' => ExtensionStatus::Active->value]);
|
||||
|
||||
return $templateInfo; // 배열 반환 (인터페이스 요구사항)
|
||||
});
|
||||
|
||||
@@ -250,7 +260,7 @@ class TemplateServiceTest extends TestCase
|
||||
public function test_throws_exception_on_manager_failure(): void
|
||||
{
|
||||
// Arrange - 고유 identifier 사용하여 트랜잭션 락 충돌 방지
|
||||
$identifier = 'test-template-' . uniqid();
|
||||
$identifier = 'test-template-'.uniqid();
|
||||
$template = Template::create([
|
||||
'identifier' => $identifier,
|
||||
'vendor' => 'test-vendor',
|
||||
|
||||
Reference in new issue
Block a user