Phase 1 — 플러그인 설치·활성화 시 권한·메뉴·환경설정 화면이 뜨는 기반 구축. 이후 발송엔진·채널·이력·템플릿 Phase 의 전제가 된다. - 관리자 환경설정 화면(3섹션: API 연동/발송 설정/연동 안내) — 비즈뿌리오 아이디·비밀번호·API 키·발신번호·알림톡 발신프로필 키·연동 환경(검수/운영). 크리덴셜은 마스킹 + 프론트 미노출. - 조회/관리 권한 2개 + 「메시지 발송 관리」 관리자 메뉴(알림톡 템플릿·발송 이력 하위). - 잔액 부족 시 관리자 알림 정의(webhook 결과코드 감지는 Phase 4). - 발송 관련 Enum 4종(채널/상태/출처/결과분류) — Phase 2~4 소비용 골격. 알림톡 채널 기본 body 시드는 채널 등록(Phase 3)·탭 연동(Phase 6)과 강결합이라 Phase 6 으로 이관(plugin.php 주석 명시). 테스트: PHPUnit 12건(설치·권한·메뉴·알림 정의·Enum) + Vitest 22건(환경설정 레이아웃). 설치→활성화 실검증으로 권한 4·메뉴 3·알림 1·설정 초기값 로드 확인.
65 lines
2.6 KiB
PHP
65 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace Plugins\Sirsoft\MessageBizppurio\Tests\Unit\Enums;
|
|
|
|
use Plugins\Sirsoft\MessageBizppurio\Enums\DispatchChannel;
|
|
use Plugins\Sirsoft\MessageBizppurio\Enums\DispatchSource;
|
|
use Plugins\Sirsoft\MessageBizppurio\Enums\DispatchStatus;
|
|
use Plugins\Sirsoft\MessageBizppurio\Enums\ResultCategory;
|
|
use Plugins\Sirsoft\MessageBizppurio\Tests\PluginTestCase;
|
|
|
|
/**
|
|
* 발송 관련 Enum 4종 검증.
|
|
*/
|
|
class EnumTest extends PluginTestCase
|
|
{
|
|
public function test_dispatch_channel_값과_helper(): void
|
|
{
|
|
$this->assertEqualsCanonicalizing(['sms', 'lms', 'alimtalk'], DispatchChannel::values());
|
|
$this->assertTrue(DispatchChannel::Sms->isText());
|
|
$this->assertTrue(DispatchChannel::Lms->isText());
|
|
$this->assertFalse(DispatchChannel::Alimtalk->isText());
|
|
$this->assertNull(DispatchChannel::tryFrom('invalid'));
|
|
}
|
|
|
|
public function test_dispatch_status_값과_final_판정(): void
|
|
{
|
|
$this->assertEqualsCanonicalizing(['pending', 'sent', 'success', 'failed'], DispatchStatus::values());
|
|
$this->assertFalse(DispatchStatus::Pending->isFinal());
|
|
$this->assertFalse(DispatchStatus::Sent->isFinal());
|
|
$this->assertTrue(DispatchStatus::Success->isFinal());
|
|
$this->assertTrue(DispatchStatus::Failed->isFinal());
|
|
}
|
|
|
|
public function test_dispatch_source_값(): void
|
|
{
|
|
$this->assertEqualsCanonicalizing(['auto', 'manual', 'bulk'], DispatchSource::values());
|
|
$this->assertSame('auto', DispatchSource::Auto->value);
|
|
}
|
|
|
|
public function test_result_category_분류_판정(): void
|
|
{
|
|
$this->assertEqualsCanonicalizing(
|
|
['success', 'retry', 'permanent_failure', 'balance_low'],
|
|
ResultCategory::values()
|
|
);
|
|
|
|
$this->assertTrue(ResultCategory::Retry->isRetryable());
|
|
$this->assertFalse(ResultCategory::Success->isRetryable());
|
|
|
|
$this->assertTrue(ResultCategory::PermanentFailure->isFailure());
|
|
$this->assertTrue(ResultCategory::BalanceLow->isFailure());
|
|
$this->assertFalse(ResultCategory::Success->isFailure());
|
|
$this->assertFalse(ResultCategory::Retry->isFailure());
|
|
}
|
|
|
|
public function test_label은_다국어_문자열을_반환한다(): void
|
|
{
|
|
// label() 이 예외 없이 문자열을 반환하는지 (lang 키 해석 스모크)
|
|
$this->assertIsString(DispatchChannel::Sms->label());
|
|
$this->assertIsString(DispatchStatus::Success->label());
|
|
$this->assertIsString(DispatchSource::Auto->label());
|
|
$this->assertIsString(ResultCategory::BalanceLow->label());
|
|
}
|
|
}
|