-
Notifications
You must be signed in to change notification settings - Fork 0
/
GetMyCommandsTest.php
42 lines (34 loc) · 1.35 KB
/
GetMyCommandsTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php namespace Tests\Bot\Methods;
use Tests\TelegramTestCase;
use TelegramPro\Bot\Methods\GetMe;
use TelegramPro\Bot\Methods\Types\User;
use TelegramPro\Bot\Methods\GetMyCommands;
use TelegramPro\Bot\Methods\SetMyCommands;
use TelegramPro\Bot\Methods\Types\BotCommand;
use TelegramPro\Bot\Methods\Types\ArrayOfBotCommands;
class GetMyCommandsTest extends TelegramTestCase
{
function testCanGetOwnCommands()
{
SetMyCommands::parameters(
ArrayOfBotCommands::fromList(
BotCommand::fromString('say_hi', 'say hi description'),
BotCommand::fromString('run_away', 'run away description'),
)
)->send($this->telegram);
$response = GetMyCommands::parameters()
->send($this->telegram);
$this->isOk($response);
self::assertInstanceOf(ArrayOfBotCommands::class, $response->commands());
self::assertCount(2, $response->commands());
SetMyCommands::parameters(
ArrayOfBotCommands::fromList(
BotCommand::fromString('say_hi', 'say hi description'),
)
)->send($this->telegram);
$response = GetMyCommands::parameters()
->send($this->telegram);
$this->isOk($response);
self::assertCount(1, $response->commands());
}
}