-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Tests\Unit; | ||
|
||
use App\Services\SpamDetector; | ||
use Tests\TestCase; | ||
|
||
class SpamDetectorTest extends TestCase | ||
{ | ||
/** | ||
* Test if the message is classified as spam. | ||
* | ||
* @dataProvider messageProvider | ||
*/ | ||
public function testIsSpam($message, $expected) | ||
{ | ||
$spamDetector = new SpamDetector($message); | ||
$this->assertEquals($expected, $spamDetector->isSpam()); | ||
} | ||
|
||
/** | ||
* Data provider for messages and expected results. | ||
*/ | ||
public static function messageProvider() | ||
{ | ||
return [ | ||
['А вот интересно кстати, какова вообще вероятность кражи токена?', false], | ||
['Нужны партнеры в сферу (крипта) заработка. Пассивный доход от 10% в месяц. Подробности в ЛС', true], | ||
['Стабильный доход от 100$ Нужен только телефон', true], | ||
['блокчейн в ЛС', true], | ||
['Крипто инвестиции', true], | ||
]; | ||
} | ||
} |