-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStopMessageLiveLocationTest.php
More file actions
48 lines (40 loc) · 1.56 KB
/
StopMessageLiveLocationTest.php
File metadata and controls
48 lines (40 loc) · 1.56 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
48
<?php namespace Tests\Bot\Methods;
use Tests\TelegramTestCase;
use TelegramPro\Bot\Types\Latitude;
use TelegramPro\Bot\Types\Longitude;
use TelegramPro\Bot\Types\LivePeriod;
use TelegramPro\Bot\Methods\SendLocation;
use TelegramPro\Bot\Methods\Types\Message;
use TelegramPro\Bot\Methods\Types\MessageId;
use TelegramPro\Bot\Methods\Types\MethodError;
use TelegramPro\Bot\Methods\StopMessageLiveLocation;
class StopMessageLiveLocationTest extends TelegramTestCase
{
function testCanStopLiveLocation()
{
$chatId = $this->config->cyclingChatId();
$locationResponse = SendLocation::parameters(
$chatId,
Latitude::fromFloat(90),
Longitude::fromFloat(-180),
LivePeriod::fromInt(400)
)->send($this->telegram);
$this->isOk($locationResponse);
$stopLocationResponse = StopMessageLiveLocation::parameters(
$chatId,
$locationResponse->sentMessage()->messageId()
)->send($this->telegram);
self::assertInstanceOf(Message::class, $stopLocationResponse->sentMessage());
}
function testCanParseError()
{
$response = StopMessageLiveLocation::parameters(
$this->config->cyclingChatId(),
MessageId::fromInt(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());
}
}