Add support for sending documents

This commit is contained in:
netkas 2024-10-08 13:58:22 -04:00
parent 3623b63eaa
commit dc9ca57e52
5 changed files with 182 additions and 0 deletions

View file

@ -0,0 +1,35 @@
<?php
namespace TgBotLib\Methods;
use PHPUnit\Framework\TestCase;
use TgBotLib\Bot;
use TgBotLib\Enums\Types\ParseMode;
use TgBotLib\Objects\LinkPreviewOptions;
use TgBotLib\Objects\Message;
class SendDocumentTest extends TestCase
{
const string TEST_DOCUMENT_PATH = __DIR__ . DIRECTORY_SEPARATOR . 'sample' . DIRECTORY_SEPARATOR . 'password.txt';
private static Bot $bot;
/**
* @return void
*/
public static function setUpBeforeClass(): void
{
self::$bot = new Bot(BOT_TOKEN);
}
public function testSendDocument(): void
{
$result = self::$bot->sendDocument(
chat_id: TEST_CHAT_ID,
document: self::TEST_DOCUMENT_PATH,
caption: 'Test Unit: testSendDocument',
);
$this->assertInstanceOf(Message::class, $result);
$this->assertEquals('Test Unit: testSendDocument', $result->getCaption());
}
}

View file

@ -0,0 +1,10 @@
The Plague: Our recent unknown intruder penetrated using the superuser account, giving him access to our whole system.
Margo: Precisely what you're paid to prevent.
The Plague: Someone didn't bother reading my carefully prepared memo on commonly-used passwords. Now, then, as I so
meticulously pointed out, the four most-used passwords are: love, sex, secret, and...
Margo: [glares at The Plague]
The Plague: god. So, would your holiness care to change her password?