Passed
Push — master ( b665cb...43d909 )
by Shahrad
02:27
created

SendPhotoTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 10
dl 0
loc 18
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_send_photo_by_path() 0 16 1
1
<?php declare(strict_types=1);
2
3
namespace TelegramBotTest\Methods;
4
5
use TelegramBot\Request;
6
use TelegramBot\Telegram;
7
use TelegramBotTest\TelegramTest;
8
9
class SendPhotoTest extends \PHPUnit\Framework\TestCase {
10
11
    public function test_send_photo_by_path(): void {
12
        TelegramTest::loadEnvironment();
13
        Telegram::setToken($_ENV['TELEGRAM_BOT_TOKEN']);
14
15
        $requestData = [
16
            'chat_id' => $_ENV['TEST_USER_ID'],
17
            'photo' => __DIR__ . '/../../logo.png'
18
        ];
19
20
        $request = Request::create('sendPhoto', $requestData);
21
22
        $this->assertEquals('https://api.telegram.org/bot' . $_ENV['TELEGRAM_BOT_TOKEN'] . '/sendPhoto', $request['url']);
23
24
        $response = Request::send('sendPhoto', $requestData);
25
26
        $this->assertTrue($response->isOk());
27
    }
28
29
}