Files
Gnuboard7/plugins/_bundled/sirsoft-verification_nhnkcp/tests/Feature/Identity/KcpInstallDefaultPurposeProviderTest.php
T
HeuJung bd215bc586 feat(identity): NHN KCP 휴대폰 본인확인 플러그인 추가
메일 인증 대신 휴대폰 본인확인을 쓸 수 있게 하는 플러그인을 추가한다.
가입·비밀번호 재설정·성인인증 등 코어 IDV 가 강제하는 모든 지점에서 동작하며,
테스트 모드로 계약 없이 전 흐름을 확인할 수 있다.

구현·검수 과정에서 드러난 저장소 전역 결함을 함께 처리했다.

- 외래키 컬럼의 한국어 comment 가 방출되지 않던 문제 (소스 38건 교정 +
 기설치본 백필 업그레이드 스텝 7종). ->comment 를 ->constrained 뒤에
 체인하면 예외 없이 통과하면서 comment 가 조용히 사라진다
- 로케일 전환 후 확장 액션 핸들러가 소실되던 문제 (플러그인 3종에
 재등록 진입점 노출)
- 본인인증 상태 폴링 응답이 누적 시도 횟수를 함께 내보내던 문제
- 인증 안내 문구와 실제 진행 방식의 폭 경계 불일치 (768~1023px).
 엔진과 같은 값을 같은 방법으로 읽도록 교정
- transition_overlay_target 이 replace 없이 무효이던 관리자 목록 40곳.
 로딩 표시가 나오지 않아도 경고가 남지 않아 화면을 봐야만 알 수 있었다

두 인증 플러그인의 코어 최소 요구 버전을 7.0.6 으로 올린다. 운영 모드
자격증명 필수 검사가 7.0.6 의 설정 저장 검증 표면에 의존하며, 그보다 낮은
코어에서는 그 검사가 조용히 통과해 빈 자격증명으로 저장할 수 있었다.

재발 차단으로 정적 검사 룰 4종을 신설하고, 검사 도구가 미커밋 신규 확장을
"검사 파일 0" 으로 통과시키던 사각을 함께 막았다.
2026-07-31 00:32:46 +09:00

112 lines
3.7 KiB
PHP

<?php
namespace Plugins\Sirsoft\VerificationNhnkcp\Tests\Feature\Identity;
use App\Services\SettingsService;
use Plugins\Sirsoft\VerificationNhnkcp\Plugin;
use Plugins\Sirsoft\VerificationNhnkcp\Tests\PluginTestCase;
/**
* 설치/삭제 시 성인인증 목적의 본인확인 수단 매핑 검증.
*
* 설치 직후 별도 설정 없이 성인인증이 KCP 로 분기되도록 초기값을 심되, 운영자가 이미 지정한
* 값이 있으면 덮어쓰지 않아야 한다(재설치 시 선택 보존). 삭제 시에는 심어 둔 값만 거두어
* 존재하지 않는 provider 를 가리키는 고아 설정을 남기지 않는다.
*
* @since 1.0.0
*/
class KcpInstallDefaultPurposeProviderTest extends PluginTestCase
{
private const SETTING_KEY = 'identity.purpose_providers.nhnkcp.adult_verification';
/**
* @scenario stage=install,existing_purpose_provider=absent
*
* @effects install_seeds_adult_purpose_provider_when_absent
*/
public function test_install_seeds_provider_when_absent(): void
{
$settings = app(SettingsService::class);
$this->assertEmpty($settings->getSetting(self::SETTING_KEY));
(new Plugin)->install();
$this->assertSame('nhnkcp', $settings->getSetting(self::SETTING_KEY));
}
/**
* @scenario stage=install,existing_purpose_provider=present
*
* @effects install_preserves_existing_purpose_provider
*/
public function test_install_preserves_operator_choice(): void
{
$settings = app(SettingsService::class);
$settings->setSetting(self::SETTING_KEY, 'g7:core.mail');
(new Plugin)->install();
$this->assertSame(
'g7:core.mail',
$settings->getSetting(self::SETTING_KEY),
'이미 지정된 운영자 선택을 덮어쓰면 안 된다',
);
}
/**
* @scenario stage=uninstall,existing_purpose_provider=absent
*
* @effects uninstall_removes_seeded_purpose_provider
*/
public function test_uninstall_removes_seeded_provider(): void
{
$settings = app(SettingsService::class);
(new Plugin)->install();
$this->assertSame('nhnkcp', $settings->getSetting(self::SETTING_KEY));
(new Plugin)->uninstall();
$this->assertEmpty(
$settings->getSetting(self::SETTING_KEY),
'삭제 후에도 존재하지 않는 provider 를 가리키는 매핑이 남으면 안 된다',
);
}
/**
* @scenario stage=uninstall,existing_purpose_provider=present
*
* @effects uninstall_preserves_operator_chosen_provider
*/
public function test_uninstall_preserves_operator_choice(): void
{
$settings = app(SettingsService::class);
$settings->setSetting(self::SETTING_KEY, 'g7:core.mail');
(new Plugin)->uninstall();
$this->assertSame(
'g7:core.mail',
$settings->getSetting(self::SETTING_KEY),
'우리가 심지 않은 값은 거두지 않는다',
);
}
/**
* @scenario stage=install,existing_purpose_provider=absent
*
* @effects install_seeds_adult_purpose_provider_when_absent
*/
public function test_declared_purpose_uses_plugin_namespace_lang_keys(): void
{
$purposes = (new Plugin)->getIdentityPurposes();
$this->assertArrayHasKey('nhnkcp.adult_verification', $purposes);
$meta = $purposes['nhnkcp.adult_verification'];
$this->assertSame('nhnkcp', $meta['default_provider']);
$this->assertSame(['phone'], $meta['allowed_channels']);
$this->assertStringStartsWith('sirsoft-verification_nhnkcp::', $meta['label']);
$this->assertNotSame($meta['label'], __($meta['label']), '다국어 키가 해석되어야 한다');
}
}