ProcessUpdateTest::get_fake_update()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace TelegramBotTest;
4
5
use Symfony\Component\Dotenv\Dotenv;
6
use TelegramBot\Entities\Update;
7
use TelegramBot\Telegram;
8
9
class ProcessUpdateTest extends \PHPUnit\Framework\TestCase
10
{
11
12
    public function test_webhook()
13
    {
14
        $update = $this->get_fake_update();
15
16
        $this->assertEquals($update->getCallbackQuery()->getData(), 'tasks-settings');
17
18
        $this->assertEquals($update->getCallbackQuery()->getId(), '1115664380233733737');
19
20
        $this->assertEquals($update->getCallbackQuery()->getInlineMessageId(), null);
21
    }
22
23
    private function get_fake_update(): Update
24
    {
25
        return Telegram::processUpdate('{"update_id":226394498,"callback_query":{"id":"1115664380233733737","from":{"id":259760855,"is_bot":false,"first_name":"Shahrad","last_name":"Elahi","username":"ShahradElahi","language_code":"en"},"message":{"message_id":4071,"from":{"id":1861977284,"is_bot":true,"first_name":"Earnomi","username":"EarnomiBot"},"chat":{"id":259760855,"first_name":"Shahrad","last_name":"Elahi","username":"ShahradElahi","type":"private"},"date":1651775842,"text":"Choose an option below to change your settings","reply_markup":{"inline_keyboard":[[{"text":"Task Alerts","callback_data":"tasks-settings"}]]}},"chat_instance":"7764778060035751380","data":"tasks-settings"}}');
26
    }
27
28
}