확장이 SP Kernel 미들웨어 그룹을 직접 조작하거나 라우트 파일에 미들웨어 FQCN 을 직접 부착하던 임시 방식을, 확장이 부착 대상(targets)을 명시 선언하고 코어가 요청 시점에 라우트명·URI 로 매칭해 실행하는 self-gate 로 정규화. 번들 7건(ecommerce/gdpr/pay 3종) 이전, audit 룰 3건·문서·버전 동기화 동반. 부수적으로 generate-skills.cjs 가 재생성 시 신의성실(부수의무) 섹션을 소실 시키던 회귀를 수정 — 스킬별 불릿을 스크립트 SSoT 로 편입해 재생성에도 보존.
34 lines
1.5 KiB
PHP
34 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Plugins\Sirsoft\Gdpr\Tests\Unit;
|
|
|
|
use Plugins\Sirsoft\Gdpr\Http\Middleware\CookieConsentMiddleware;
|
|
use Plugins\Sirsoft\Gdpr\Plugin;
|
|
use Plugins\Sirsoft\Gdpr\Tests\PluginTestCase;
|
|
|
|
/**
|
|
* GDPR 플러그인 미들웨어 선언 계약 테스트.
|
|
*
|
|
* CookieConsentMiddleware 를 코어 self-gate 방식(getMiddleware())으로 선언한다.
|
|
* EDPB Guidelines 2/2023 §16 사전 차단 요건을 위해 web/api 전 응답을 대상으로 하므로
|
|
* targets=['everything'](광역), timing=before_core(코어 전처리 전) 여야 한다.
|
|
*/
|
|
class PluginMiddlewareDeclarationTest extends PluginTestCase
|
|
{
|
|
/**
|
|
* @effects gdpr_cookie_consent_declared_everything_before_core
|
|
*/
|
|
public function test_declares_cookie_consent_middleware_via_get_middleware(): void
|
|
{
|
|
$plugin = new Plugin;
|
|
|
|
$declaration = collect($plugin->getMiddleware())
|
|
->firstWhere('class', CookieConsentMiddleware::class);
|
|
|
|
$this->assertNotNull($declaration, 'Plugin::getMiddleware() 가 CookieConsentMiddleware 를 선언해야 합니다.');
|
|
$this->assertEqualsCanonicalizing(['web', 'api'], $declaration['groups'], 'web/api 양 그룹 선언이어야 합니다 (전 응답 대상).');
|
|
$this->assertSame('before_core', $declaration['timing'] ?? null, '코어 전처리 전 응답 처리를 위해 before_core 여야 합니다.');
|
|
$this->assertContains('everything', $declaration['targets'], 'EDPB §16 광역 타게팅을 위해 targets=everything 이어야 합니다.');
|
|
}
|
|
}
|