<?php use PHPUnit\Framework\TestCase; // exclude "./../src/" final class EuroTomanIntentTest extends TestCase { private $translate_bot; function setUp(): void { $BOT_USER = '@TranslateGerman_bot'; $BOT_TOKEN = '816983194:AAH1pPCba__pNRFK7h6fFMoy-9twUuxJ-n8'; $uriParts = explode("?", $_SERVER['REQUEST_URI']); $actual_link = "https://$_SERVER[HTTP_HOST]" . $uriParts[0]; $WEBHOOK_URL = "$actual_link"; $SIGN = "پوشش خبری شهر های آلمان " . PHP_EOL . "@TranslateGerman_bot"; $this->translate_bot = new TranslateGerman($BOT_USER, $BOT_TOKEN, $WEBHOOK_URL, $SIGN); $bot = $this->getMockBuilder('Bot') ->setConstructorArgs(array($BOT_USER, $BOT_TOKEN, $WEBHOOK_URL, $SIGN)) ->getMock(); $member["status"] = "member"; $bot->method("apiRequest")->willReturn($member); $this->translate_bot->bot = $bot; $this->getTG()->getDB()->removeAllUserActivites(); } function getTG(): TranslateGerman { return $this->translate_bot; } function reset() { $this->getTG()->params = null; $this->getTG()->method = null; } /** * @group failing */ public function testEuroToman(): void { $this->getTG()->message['from']['id'] = 123456; $IS = new IntentService($this->getTG()); $txt = "300 eur"; $intents = $IS->findIntents($txt); $expectedIntent = new EuroToman($IS); $filteredIntent = array_values(array_filter($intents, function (Intent $intent) use ($expectedIntent) { if ($intent->name === $expectedIntent->name) return true; })); $this->assertEquals($filteredIntent[0]->name, $expectedIntent->name); $this->reset(); } public function testEuroTomanPersian(): void { $this->getTG()->message['from']['id'] = 123456; $IS = new IntentService($this->getTG()); $txt = "۳۰۰ یورو"; $intents = $IS->findIntents($txt); $expectedIntent = new EuroToman($IS); $filteredIntent = array_values(array_filter($intents, function (Intent $intent) use ($expectedIntent) { if ($intent->name === $expectedIntent->name) return true; })); $this->assertEquals($filteredIntent[0]->name, $expectedIntent->name); $this->reset(); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
adresses | Folder | 0755 |
|
|
advertise | Folder | 0755 |
|
|
database | Folder | 0755 |
|
|
drive-german | Folder | 0755 |
|
|
german | Folder | 0755 |
|
|
invited | Folder | 0755 |
|
|
ocr | Folder | 0755 |
|
|
patreon | Folder | 0755 |
|
|
speech | Folder | 0755 |
|
|
swedish | Folder | 0755 |
|
|
tamasbabot | Folder | 0755 |
|
|
videos | Folder | 0755 |
|
|
DateConverterIntentTest.php | File | 11.98 KB | 0755 |
|
EuroTomanIntentTest.php | File | 2.4 KB | 0755 |
|
EuroTomanTest.php | File | 1.44 KB | 0755 |
|
GeneralTest.php | File | 1.79 KB | 0755 |
|
verbose.php | File | 20 B | 0755 |
|