Add support for sending documents
This commit is contained in:
parent
3623b63eaa
commit
dc9ca57e52
5 changed files with 182 additions and 0 deletions
35
tests/TgBotLib/Methods/SendDocumentTest.php
Normal file
35
tests/TgBotLib/Methods/SendDocumentTest.php
Normal 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());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue