| Total Complexity | 2 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class RequestTest extends \PHPUnit\Framework\TestCase |
||
| 10 | { |
||
| 11 | |||
| 12 | public function test_request_creation(): void |
||
| 13 | { |
||
| 14 | TelegramTest::loadEnvironment(); |
||
| 15 | Telegram::setToken($_ENV['TELEGRAM_BOT_TOKEN']); |
||
| 16 | |||
| 17 | $result = Request::create('sendMessage', [ |
||
| 18 | 'chat_id' => '259760855', |
||
| 19 | 'text' => 'text', |
||
| 20 | 'parse_mode' => 'Markdown', |
||
| 21 | ]); |
||
| 22 | |||
| 23 | $expected = [ |
||
| 24 | 'url' => "https://api.telegram.org/bot{$_ENV['TELEGRAM_BOT_TOKEN']}/sendMessage", |
||
| 25 | 'method' => 'GET', |
||
| 26 | 'options' => [ |
||
| 27 | 'headers' => [ |
||
| 28 | 'Accept' => 'application/json', |
||
| 29 | 'User-Agent' => 'TelegramBot-PHP/v1.0.0' |
||
| 30 | ], |
||
| 31 | 'query' => [ |
||
| 32 | 'chat_id' => '259760855', |
||
| 33 | 'text' => 'text', |
||
| 34 | 'parse_mode' => 'Markdown', |
||
| 35 | ], |
||
| 36 | ], |
||
| 37 | ]; |
||
| 38 | |||
| 39 | $this->assertEquals($expected, $result); |
||
| 40 | } |
||
| 41 | |||
| 42 | public function test_send_message(): void |
||
| 53 | } |
||
| 54 | |||
| 56 |