fix(core,board,ecommerce): 조건부 검증 결함 패밀리 일괄 수정 및 실패 안내 노출

여러 화면에서 조건부(FormRequest) 검증이 우회되거나 과도하게 제한되던 결함을 한 계열로 묶어 수정한다.

- 검증 규칙 확장 필터 이름 10개를 나머지 92개와 동일 규칙으로 통일
- 설명 길이를 바이트가 아닌 글자 수로 계산(한글 오검출 해소)
- 비활성 언어팩 번역 보존한 채 수정 허용
- 알림 템플릿 제목 nullable 존중, 미지원 발송 수단 저장 차단
- 일정/실행 이력 목록 조회 검증 정합
- 게시판 첨부 미사용 시 빈 확장자 통과, new_display_hours/최소 길이 0 허용, 일괄 적용 override_values 범위 검증(SSoT)
- 이커머스 클레임 사유 조회 검증, 용어 정정
- 원문 i18n 키 노출 다수 해소, 저장/삭제 실패 시 사유 화면 노출
- 아이콘 크기/다크모드 대비 회귀 수정

번들 확장(모듈3·플러그인6·템플릿2·언어팩5) 버전 new-bump 및 CHANGELOG 반영, ja 언어팩 동기.
This commit is contained in:
HeuJung committed 2026-07-23 10:54:17 +09:00
1 parent c001b30a87
commit 7f8fb6870f
288 files changed
+5339 -1049

No files matched your search

@@ -0,0 +1,114 @@
<?php
namespace Tests\Unit\Http\Requests;
use App\Http\Requests\Plugin\InstallPluginFromFileRequest;
use App\Http\Requests\Plugin\InstallPluginFromGithubRequest;
use App\Http\Requests\Plugin\PreviewPluginManifestRequest;
use Tests\TestCase;
/**
* 플러그인 설치 요청의 검증 안내 문구가 실제 문장으로 해석되는지 검증.
*
* `lang/{ko,en}/plugins.php` 에 `validation` 블록이 두 번 선언돼 있어, PHP 가 뒤 선언으로
* 앞 블록을 덮으면서 GitHub/ZIP 설치 관련 7키가 런타임에 존재하지 않던 회귀가 있었다.
* `__()` 는 미정의 키에 대해 **키 문자열을 그대로 반환**하므로, 설치 검증 실패 화면에
* `plugins.validation.file_must_be_zip` 같은 원문 키가 사용자에게 노출됐다.
*
* 정적 검출은 audit 룰 `lang-duplicate-array-key` 가 담당하고, 이 테스트는 소비 지점에서
* 실제 해석 결과를 확인해 같은 회귀를 이중으로 차단한다.
*/
class PluginInstallRequestMessagesTest extends TestCase
{
/**
* 메시지 배열의 모든 값이 원문 키가 아닌 해석된 문장이어야 한다.
*
* @param array<string, string> $messages FormRequest 가 반환한 메시지 배열
*/
private function assertAllMessagesResolved(array $messages, string $context): void
{
$this->assertNotEmpty($messages, "{$context}: 메시지 배열이 비어 있습니다");
foreach ($messages as $rule => $message) {
$this->assertStringNotContainsString(
'plugins.validation.',
$message,
"{$context}: '{$rule}' 안내가 해석되지 않은 원문 키입니다 — {$message}"
);
$this->assertNotSame('', trim($message), "{$context}: '{$rule}' 안내가 비어 있습니다");
}
}
/**
* GitHub 주소 설치 요청의 안내 문구가 모두 해석된다.
*/
public function test_github_install_messages_are_resolved(): void
{
$this->assertAllMessagesResolved(
(new InstallPluginFromGithubRequest)->messages(),
'InstallPluginFromGithubRequest'
);
}
/**
* ZIP 파일 업로드 설치 요청의 안내 문구가 모두 해석된다.
*/
public function test_file_install_messages_are_resolved(): void
{
$this->assertAllMessagesResolved(
(new InstallPluginFromFileRequest)->messages(),
'InstallPluginFromFileRequest'
);
}
/**
* manifest 미리보기 요청의 안내 문구가 모두 해석된다.
*/
public function test_manifest_preview_messages_are_resolved(): void
{
$this->assertAllMessagesResolved(
(new PreviewPluginManifestRequest)->messages(),
'PreviewPluginManifestRequest'
);
}
/**
* ko/en 양쪽에 7키가 모두 정의되어 있어야 한다 (한쪽만 있으면 로케일에 따라 회귀).
*
* @dataProvider localeProvider
*/
public function test_install_validation_keys_defined_in_all_base_locales(string $locale): void
{
$keys = [
'github_url_required',
'github_url_invalid',
'github_url_format',
'file_required',
'file_invalid',
'file_must_be_zip',
'file_max_size',
];
foreach ($keys as $key) {
$full = "plugins.validation.{$key}";
$this->assertNotSame(
$full,
__($full, [], $locale),
"[{$locale}] '{$full}' 가 정의되지 않아 원문 키가 그대로 반환됩니다"
);
}
}
/**
* 기준 로케일 목록.
*
* @return array<string, array{string}> 로케일 데이터셋
*/
public static function localeProvider(): array
{
return [
'ko' => ['ko'],
'en' => ['en'],
];
}
}
@@ -55,8 +55,19 @@ class DirectoryPermissionScanDepthTest extends TestCase
$_SERVER['SCRIPT_NAME'] = '/install/index.php';
}
require_once dirname(__DIR__, 3).'/public/install/includes/config.php';
require_once dirname(__DIR__, 3).'/public/install/includes/functions.php';
// BASE_PATH 를 temp 트리로 잡는 테스트라 config.php 의
// `require BASE_PATH.'/app/Support/*.php'` 가 해석되지 않는다.
// config.php 는 class_exists(.., false) 가드를 두고 있으므로 실제 프로젝트의
// 파일을 먼저 로드해 두면 그 require 를 건너뛴다.
$projectRoot = dirname(__DIR__, 3);
foreach (['PrivilegedDatabaseAccounts', 'OpcacheStatus'] as $supportClass) {
if (! class_exists('App\\Support\\'.$supportClass, false)) {
require_once $projectRoot.'/app/Support/'.$supportClass.'.php';
}
}
require_once $projectRoot.'/public/install/includes/config.php';
require_once $projectRoot.'/public/install/includes/functions.php';
}
public static function tearDownAfterClass(): void
@@ -9,6 +9,8 @@ use App\Models\NotificationDefinition;
use App\Models\NotificationTemplate;
use App\Models\Role;
use App\Models\User;
use App\Notifications\GenericNotification;
use App\Notifications\GuestNotifiable;
use App\Services\NotificationDefinitionService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Notification;
@@ -30,6 +32,9 @@ class NotificationDispatchIntegrationTest extends TestCase
protected function setUp(): void
{
parent::setUp();
// 메일 발송을 단언하므로 mail 채널을 준비 완료 상태로 만든다
// (기본 테스트 설정은 from_address 가 플레이스홀더라 readiness 가 false 다)
$this->enableMailChannelReadiness();
Notification::fake();
$this->listener = app(NotificationHookListener::class);
}
@@ -106,7 +111,7 @@ class NotificationDispatchIntegrationTest extends TestCase
$this->registerAndFire('core.test.after_trigger', $user);
Notification::assertSentTo($user, \App\Notifications\GenericNotification::class);
Notification::assertSentTo($user, GenericNotification::class);
}
// ──────────────────────────────────────────────
@@ -137,8 +142,8 @@ class NotificationDispatchIntegrationTest extends TestCase
$this->registerAndFire('core.test.after_role', null);
Notification::assertSentTo($admin1, \App\Notifications\GenericNotification::class);
Notification::assertSentTo($admin2, \App\Notifications\GenericNotification::class);
Notification::assertSentTo($admin1, GenericNotification::class);
Notification::assertSentTo($admin2, GenericNotification::class);
}
// ──────────────────────────────────────────────
@@ -163,9 +168,9 @@ class NotificationDispatchIntegrationTest extends TestCase
$this->registerAndFire('core.test.after_specific', null);
Notification::assertSentTo($user1, \App\Notifications\GenericNotification::class);
Notification::assertSentTo($user2, \App\Notifications\GenericNotification::class);
Notification::assertNotSentTo($other, \App\Notifications\GenericNotification::class);
Notification::assertSentTo($user1, GenericNotification::class);
Notification::assertSentTo($user2, GenericNotification::class);
Notification::assertNotSentTo($other, GenericNotification::class);
}
// ──────────────────────────────────────────────
@@ -200,8 +205,8 @@ class NotificationDispatchIntegrationTest extends TestCase
$this->registerAndFire('core.test.after_excl', $triggerUser);
Notification::assertSentTo($otherAdmin, \App\Notifications\GenericNotification::class);
Notification::assertNotSentTo($triggerUser, \App\Notifications\GenericNotification::class);
Notification::assertSentTo($otherAdmin, GenericNotification::class);
Notification::assertNotSentTo($triggerUser, GenericNotification::class);
}
// ──────────────────────────────────────────────
@@ -240,7 +245,7 @@ class NotificationDispatchIntegrationTest extends TestCase
$this->registerAndFire('core.test.after_multi', $user);
// 동일 사용자이므로 1건만 발송
Notification::assertSentTo($user, \App\Notifications\GenericNotification::class, function ($notification) {
Notification::assertSentTo($user, GenericNotification::class, function ($notification) {
return true;
});
Notification::assertCount(1);
@@ -267,7 +272,7 @@ class NotificationDispatchIntegrationTest extends TestCase
$this->registerAndFire('core.test.after_no_filter', null);
// 수신자는 결정되지만 data가 빈 상태로 발송
Notification::assertSentTo($admin, \App\Notifications\GenericNotification::class);
Notification::assertSentTo($admin, GenericNotification::class);
}
// ──────────────────────────────────────────────
@@ -333,7 +338,7 @@ class NotificationDispatchIntegrationTest extends TestCase
$this->registerAndFire('core.test.after_legacy', $user);
Notification::assertSentTo($user, \App\Notifications\GenericNotification::class);
Notification::assertSentTo($user, GenericNotification::class);
}
// ──────────────────────────────────────────────
@@ -343,7 +348,7 @@ class NotificationDispatchIntegrationTest extends TestCase
public function test_core_welcome_extract_data(): void
{
$user = User::factory()->create();
$listener = new CoreNotificationDataListener();
$listener = new CoreNotificationDataListener;
$result = $listener->extractData(
['notifiable' => null, 'notifiables' => null, 'data' => [], 'context' => []],
@@ -364,7 +369,7 @@ class NotificationDispatchIntegrationTest extends TestCase
public function test_core_reset_password_extract_data(): void
{
$user = User::factory()->create();
$listener = new CoreNotificationDataListener();
$listener = new CoreNotificationDataListener;
$result = $listener->extractData(
['notifiable' => null, 'notifiables' => null, 'data' => [], 'context' => []],
@@ -383,7 +388,7 @@ class NotificationDispatchIntegrationTest extends TestCase
public function test_core_password_changed_extract_data(): void
{
$user = User::factory()->create();
$listener = new CoreNotificationDataListener();
$listener = new CoreNotificationDataListener;
$result = $listener->extractData(
['notifiable' => null, 'notifiables' => null, 'data' => [], 'context' => []],
@@ -402,7 +407,7 @@ class NotificationDispatchIntegrationTest extends TestCase
public function test_core_unknown_type_returns_default(): void
{
$listener = new CoreNotificationDataListener();
$listener = new CoreNotificationDataListener;
$default = ['notifiable' => null, 'notifiables' => null, 'data' => [], 'context' => []];
$result = $listener->extractData($default, 'unknown_type', []);
@@ -431,7 +436,7 @@ class NotificationDispatchIntegrationTest extends TestCase
$this->registerAndFire('core.test.after_fallback', null);
Notification::assertSentTo($superAdmin, \App\Notifications\GenericNotification::class);
Notification::assertSentTo($superAdmin, GenericNotification::class);
}
// ──────────────────────────────────────────────
@@ -497,8 +502,8 @@ class NotificationDispatchIntegrationTest extends TestCase
// 비회원은 GuestNotifiable 수신자로 발송된다 (회원과 동일한 notify 경로).
// fake 는 같은 클래스 + getKey() 로 매칭하므로 동일 이메일 게스트로 단언한다.
Notification::assertSentTo(
new \App\Notifications\GuestNotifiable('guest@example.com'),
\App\Notifications\GenericNotification::class
new GuestNotifiable('guest@example.com'),
GenericNotification::class
);
}
@@ -4,8 +4,9 @@ namespace Tests\Unit\Notifications;
use App\Models\NotificationDefinition;
use App\Models\NotificationTemplate;
use App\Notifications\GuestNotifiable;
use App\Models\User;
use App\Notifications\GenericNotification;
use App\Notifications\GuestNotifiable;
use App\Services\NotificationChannelService;
use App\Services\NotificationTemplateService;
use Tests\TestCase;
@@ -24,6 +25,10 @@ class GenericNotificationGuestGateTest extends TestCase
{
parent::setUp();
// 메일 발송 통과를 단언하므로 mail 채널을 준비 완료 상태로 만든다
// (기본 테스트 설정은 from_address 가 플레이스홀더라 readiness 가 false 다)
$this->enableMailChannelReadiness();
$templateService = app(NotificationTemplateService::class);
foreach (['mail', 'database'] as $ch) {
$templateService->invalidateCache('guest_gate_check', $ch);
@@ -106,7 +111,7 @@ class GenericNotificationGuestGateTest extends TestCase
public function test_member_is_unaffected_by_guest_gate(): void
{
$member = \App\Models\User::factory()->make();
$member = User::factory()->make();
// 회원은 게스트 게이트 무영향 — database 채널도 정상 통과(템플릿 존재 + readiness)
$this->assertSame(['database'], $this->notification('database')->via($member));
@@ -8,6 +8,7 @@ use App\Models\Schedule;
use App\Models\ScheduleHistory;
use App\Services\ScheduleService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Pagination\LengthAwarePaginator;
use Tests\TestCase;
/**
@@ -34,6 +35,58 @@ class ScheduleServiceTest extends TestCase
parent::tearDown();
}
// ========================================================================
// getPaginatedSchedules() / getHistory() - 반환 타입 해석 검증
// ========================================================================
/**
* 스케줄이 존재할 때 목록 조회가 TypeError 없이 페이지네이터를 반환하는지 확인
*
* 회귀 배경: LengthAwarePaginator 를 import 하지 않아 반환 타입이
* App\Services\LengthAwarePaginator 로 해석되어 목록 API 가 500 을 반환했다.
*/
public function test_get_paginated_schedules_returns_paginator(): void
{
Schedule::create([
'name' => '목록 조회 테스트 스케줄',
'type' => ScheduleType::Artisan,
'command' => 'inspire',
'expression' => '* * * * *',
'is_active' => true,
]);
$result = $this->scheduleService->getPaginatedSchedules([]);
$this->assertInstanceOf(LengthAwarePaginator::class, $result);
$this->assertSame(1, $result->total());
}
/**
* 실행 이력이 존재할 때 이력 조회가 TypeError 없이 페이지네이터를 반환하는지 확인
*/
public function test_get_history_returns_paginator(): void
{
$schedule = Schedule::create([
'name' => '이력 조회 테스트 스케줄',
'type' => ScheduleType::Artisan,
'command' => 'inspire',
'expression' => '* * * * *',
'is_active' => true,
]);
ScheduleHistory::create([
'schedule_id' => $schedule->id,
'started_at' => now(),
'finished_at' => now(),
'result_status' => 'success',
]);
$result = $this->scheduleService->getHistory($schedule->id, []);
$this->assertInstanceOf(LengthAwarePaginator::class, $result);
$this->assertSame(1, $result->total());
}
// ========================================================================
// delete() - 관계 레코드 명시적 삭제 검증
// ========================================================================