diff --git a/src/ProfaneValidator.php b/src/ProfaneValidator.php index 31e6430..b0dbacc 100644 --- a/src/ProfaneValidator.php +++ b/src/ProfaneValidator.php @@ -43,7 +43,7 @@ class ProfaneValidator */ public function isProfane($text) { - return str_contains($text, $this->badwords); + return Str::containsCaseless($text, $this->badwords); } public function getBadwords() diff --git a/src/Str.php b/src/Str.php new file mode 100644 index 0000000..42152e5 --- /dev/null +++ b/src/Str.php @@ -0,0 +1,25 @@ +assertTrue($profane->isProfane($word)); } + public function test_can_evaluate_as_caseless_mode() + { + $word = 'FUCK you BITCH if you read this.'; + $this->mockConfigs(); + + $profane = new ProfaneValidator(); + + $this->assertTrue($profane->isProfane($word)); + } + public function test_can_set_dictionary_when_you_pass_a_locale() { $this->mockConfigs();