Fix object instantiation and add getUpdate functionality
This commit is contained in:
parent
845a0d3b3c
commit
f2f26998ad
6 changed files with 57 additions and 12 deletions
42
tests/TgBotLib/Methods/GetUpdatesTest.php
Normal file
42
tests/TgBotLib/Methods/GetUpdatesTest.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Types\ParseMode;
|
||||
use TgBotLib\Objects\LinkPreviewOptions;
|
||||
use TgBotLib\Objects\Message;
|
||||
use TgBotLib\Objects\MessageId;
|
||||
use TgBotLib\Objects\Update;
|
||||
|
||||
class GetUpdatesTest extends TestCase
|
||||
{
|
||||
private static Bot $bot;
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
self::$bot = new Bot(BOT_TOKEN);
|
||||
self::$bot->setAutoRetry(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the `sendMessage` function of the bot instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetUpdatesTest(): void
|
||||
{
|
||||
$result = self::$bot->getUpdates();
|
||||
|
||||
if(count($result) > 0)
|
||||
{
|
||||
$this->assertInstanceOf(Update::class, $result[0]);
|
||||
}
|
||||
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue