Longman\TelegramBot\Tests\Unit\TestHelpers::getFakeUpdateCommandObject PHP Метод

getFakeUpdateCommandObject() публичный статический Метод

Return a fake command object for the passed command text
public static getFakeUpdateCommandObject ( string $command_text ) : Update
$command_text string
Результат Longman\TelegramBot\Entities\Update
    public static function getFakeUpdateCommandObject($command_text)
    {
        $data = ['update_id' => mt_rand(), 'message' => ['message_id' => mt_rand(), 'from' => self::$user_template, 'chat' => self::$chat_template, 'date' => time(), 'text' => $command_text]];
        return self::getFakeUpdateObject($data);
    }

Usage Example

 public function testEchoCommandExecuteWithParameter()
 {
     $text = $this->command->setUpdate(TestHelpers::getFakeUpdateCommandObject('/echo Message!'))->execute()->getResult()->getText();
     $this->assertEquals('Message!', $text);
 }
All Usage Examples Of Longman\TelegramBot\Tests\Unit\TestHelpers::getFakeUpdateCommandObject