File tree 2 files changed +10
-0
lines changed
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,10 @@ public function hasTooManySpecialCharacters()
105
105
->squish ()
106
106
->wordCount ();
107
107
108
+ if ($ countWords === 0 ) {
109
+ return true ;
110
+ }
111
+
108
112
$ diff = ($ withSpecialCharacters - $ withOutSpecialCharacters ) / 2 ;
109
113
110
114
// Proportion of special characters in the message
Original file line number Diff line number Diff line change @@ -144,4 +144,10 @@ public function testMessageOneSpecialCharacters(): void
144
144
$ spamDetector = new SpamDetector ('🔥 ' );
145
145
$ this ->assertTrue ($ spamDetector ->hasTooManySpecialCharacters ());
146
146
}
147
+
148
+ public function testMessageSpecialCharacters (): void
149
+ {
150
+ $ spamDetector = new SpamDetector ('✅ 🔤🔤🔤🔤 🔤🔤🔤🔤🔤🔤 ✅ 🔠🔠🔠🔠🔠 🔠 🔠🔠🔠🔠🔠🔠🔠 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥 ♦️🔺🔺♦️♦️ ♦️🔺🔺🔺 4️⃣2️⃣5️⃣💲 🔡 🔡🔡🔡🔡 ⚪️⚪️🔴⚪️⚪️🔴 🔴⚪️⚪️ 🔤🔤🔤🔤🔤🔤 🔤 🔤🔤 ' );
151
+ $ this ->assertTrue ($ spamDetector ->hasTooManySpecialCharacters ());
152
+ }
147
153
}
You can’t perform that action at this time.
0 commit comments