Files
jongryangje/tests/unit/PiiMaskTest.php

43 lines
1.3 KiB
PHP
Raw Normal View History

<?php
declare(strict_types=1);
use CodeIgniter\Test\CIUnitTestCase;
/**
* @internal
*/
final class PiiMaskTest extends CIUnitTestCase
{
protected function setUp(): void
{
parent::setUp();
helper('pii_mask');
}
public function testMaskPersonNameEmpty(): void
{
$this->assertSame('', mask_person_name(null));
$this->assertSame('', mask_person_name(''));
}
public function testMaskPersonNameKorean(): void
{
$this->assertSame('*', mask_person_name('홍'));
$this->assertSame('김*', mask_person_name('김철'));
$this->assertSame('홍*동', mask_person_name('홍길동'));
$this->assertSame('남**수', mask_person_name('남궁민수'));
}
public function testMaskMobilePhone(): void
{
$this->assertSame('', mask_mobile_phone(null));
$this->assertSame('', mask_mobile_phone(''));
$this->assertSame('010-****-5678', mask_mobile_phone('010-1234-5678'));
$this->assertSame('010-****-5678', mask_mobile_phone('01012345678'));
$this->assertSame('010-****-5678', mask_mobile_phone('821012345678'));
$this->assertSame('02-****-7890', mask_mobile_phone('0212347890'));
$this->assertSame('010-****-2312', mask_mobile_phone('0102312'));
}
}