2024-09-30 02:34:07 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace TgBotLib\Methods;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use TgBotLib\Bot;
|
2024-10-02 00:18:12 -04:00
|
|
|
use TgBotLib\Objects\User;
|
2024-09-30 02:34:07 -04:00
|
|
|
|
|
|
|
class GetMeTest extends TestCase
|
|
|
|
{
|
|
|
|
private $bot;
|
|
|
|
protected function setUp(): void
|
|
|
|
{
|
|
|
|
$this->bot = new Bot(BOT_TOKEN);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This test checks if the `execute` method of the `getMe` class correctly calls `fromArray` method of User class
|
|
|
|
* and `executeCurl` method of the `getMe` class (itself), with correctly built parameters.
|
|
|
|
*
|
|
|
|
* Method `execute` should return User object constructed from the array returned by `executeCurl`.
|
|
|
|
*/
|
|
|
|
public function testExecute()
|
|
|
|
{
|
|
|
|
$user = getMe::execute($this->bot);
|
|
|
|
$this->assertInstanceOf(User::class, $user);
|
|
|
|
}
|
|
|
|
}
|