-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetChatAdministratorCustomTitleTest.php
More file actions
47 lines (41 loc) · 1.69 KB
/
SetChatAdministratorCustomTitleTest.php
File metadata and controls
47 lines (41 loc) · 1.69 KB
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
43
44
45
46
47
<?php namespace Tests\Bot\Methods;
use Tests\TelegramTestCase;
use TelegramPro\Bot\Methods\GetMe;
use TelegramPro\Bot\Methods\Types\Message;
use TelegramPro\Bot\Methods\Types\MethodError;
use TelegramPro\Bot\Methods\SetChatAdministratorCustomTitle;
use TelegramPro\Bot\Methods\Types\ChatAdministratorCustomTitle;
class SetChatAdministratorCustomTitleTest extends TelegramTestCase
{
/**
* @doesNotPerformAssertions
* @todo this can only be applied to cert types of channels
* set up those channels for testing
*/
function testSetChatAdministratorCustomTitle()
{
// $getMeResponse = GetMe::parameters()->send($this->telegram);
//
// $response = SetChatAdministratorCustomTitle::parameters(
// $this->config->chatId(),
// $getMeResponse->botInformation()->userId(),
// ChatAdministratorCustomTitle::fromString('custom title 123')
// )->send($this->telegram);
//
// $this->isOk($response);
// self::assertInstanceOf(Message::class, $response->customTitleWasSet());
}
function testCanParseError()
{
$getMeResponse = GetMe::parameters()->send($this->telegram);
$response = SetChatAdministratorCustomTitle::parameters(
$this->config->cyclingChatId(),
$getMeResponse->botInformation()->userId(),
ChatAdministratorCustomTitle::fromString('custom title 123')
)->send($this->telegram);
self::assertFalse($response->ok());
self::assertInstanceOf(MethodError::class, $response->error());
self::assertSame('400', $response->error()->code());
self::assertNotEmpty($response->error()->description());
}
}