From 39d5313a2ca699a819ac001692c00659f203b30a Mon Sep 17 00:00:00 2001 From: nationalcat Date: Tue, 20 Jun 2017 13:57:38 +0800 Subject: [PATCH] add zh-TW locale --- src/dict/zh-tw.php | 87 ++++++++++++++++++++++++++++++++++ src/lang/zh-tw/validation.php | 5 ++ tests/ProfaneValidatorTest.php | 8 ++-- 3 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 src/dict/zh-tw.php create mode 100644 src/lang/zh-tw/validation.php diff --git a/src/dict/zh-tw.php b/src/dict/zh-tw.php new file mode 100644 index 0000000..cad3c14 --- /dev/null +++ b/src/dict/zh-tw.php @@ -0,0 +1,87 @@ + ':attribute欄位內容包含粗俗用詞,請您修正:)' +]; diff --git a/tests/ProfaneValidatorTest.php b/tests/ProfaneValidatorTest.php index d93a3b2..dd72042 100644 --- a/tests/ProfaneValidatorTest.php +++ b/tests/ProfaneValidatorTest.php @@ -28,8 +28,8 @@ class ProfaneValidatorTest extends PHPUnit_Framework_TestCase { $this->mockConfigs(); $attribute = 'description'; - $text = 'fck you bitch'; - $parameters = ['es', 'en']; + $text = 'fck you bitch. 幹!'; + $parameters = ['es', 'en' , 'zh-TW']; $profane = new ProfaneValidator(); @@ -117,9 +117,9 @@ class ProfaneValidatorTest extends PHPUnit_Framework_TestCase $this->mockConfigs(); $profane = new ProfaneValidator(); - $profane->setDictionary(['es', 'en']); + $profane->setDictionary(['es', 'en', 'it', 'zh-TW']); - $expected = array_merge(include __DIR__.'/../src/dict/es.php', include __DIR__.'/../src/dict/en.php'); + $expected = array_merge(include __DIR__.'/../src/dict/es.php', include __DIR__.'/../src/dict/en.php', include __DIR__.'/../src/dict/it.php', include __DIR__.'/../src/dict/zh-TW.php'); $this->assertEquals($profane->getBadwords(), $expected); }