Old request class renamed to Client

parent 404efd8e
...@@ -13,7 +13,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands; ...@@ -13,7 +13,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands;
use Longman\TelegramBot\Commands\AdminCommand; use Longman\TelegramBot\Commands\AdminCommand;
use Longman\TelegramBot\DB; use Longman\TelegramBot\DB;
use Longman\TelegramBot\Entities\Chat; use Longman\TelegramBot\Entities\Chat;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
class ChatsCommand extends AdminCommand class ChatsCommand extends AdminCommand
{ {
...@@ -135,6 +135,6 @@ class ChatsCommand extends AdminCommand ...@@ -135,6 +135,6 @@ class ChatsCommand extends AdminCommand
'text' => $text_back, 'text' => $text_back,
]; ];
return Request::sendMessage($data); return Client::sendMessage($data);
} }
} }
...@@ -13,7 +13,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands; ...@@ -13,7 +13,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands;
use Longman\TelegramBot\Commands\AdminCommand; use Longman\TelegramBot\Commands\AdminCommand;
use Longman\TelegramBot\DB; use Longman\TelegramBot\DB;
use Longman\TelegramBot\Exception\TelegramException; use Longman\TelegramBot\Exception\TelegramException;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
use Longman\TelegramBot\TelegramLog; use Longman\TelegramBot\TelegramLog;
use PDOException; use PDOException;
...@@ -339,7 +339,7 @@ class CleanupCommand extends AdminCommand ...@@ -339,7 +339,7 @@ class CleanupCommand extends AdminCommand
'text' => '*No database connection!*', 'text' => '*No database connection!*',
]; ];
return Request::sendMessage($data); return Client::sendMessage($data);
} }
/** /**
...@@ -375,7 +375,7 @@ class CleanupCommand extends AdminCommand ...@@ -375,7 +375,7 @@ class CleanupCommand extends AdminCommand
$data['text'] = 'Cleaning up tables:' . PHP_EOL . implode(PHP_EOL, $infos); $data['text'] = 'Cleaning up tables:' . PHP_EOL . implode(PHP_EOL, $infos);
Request::sendMessage($data); Client::sendMessage($data);
$rows = 0; $rows = 0;
$pdo = DB::getPdo(); $pdo = DB::getPdo();
...@@ -395,7 +395,7 @@ class CleanupCommand extends AdminCommand ...@@ -395,7 +395,7 @@ class CleanupCommand extends AdminCommand
$pdo->rollBack(); // rollback changes on exception (useful if you want to track down error - you can't replicate it when some of the data is already deleted...) $pdo->rollBack(); // rollback changes on exception (useful if you want to track down error - you can't replicate it when some of the data is already deleted...)
$data['text'] = '*Database cleanup failed!* _(check your error logs)_'; $data['text'] = '*Database cleanup failed!* _(check your error logs)_';
Request::sendMessage($data); Client::sendMessage($data);
throw new TelegramException($e->getMessage()); throw new TelegramException($e->getMessage());
} }
...@@ -406,6 +406,6 @@ class CleanupCommand extends AdminCommand ...@@ -406,6 +406,6 @@ class CleanupCommand extends AdminCommand
$data['text'] = '*No data to clean!*'; $data['text'] = '*No data to clean!*';
} }
return Request::sendMessage($data); return Client::sendMessage($data);
} }
} }
...@@ -12,7 +12,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands; ...@@ -12,7 +12,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands;
use Longman\TelegramBot\Commands\AdminCommand; use Longman\TelegramBot\Commands\AdminCommand;
use Longman\TelegramBot\DB; use Longman\TelegramBot\DB;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
/** /**
* Admin "/debug" command * Admin "/debug" command
...@@ -57,7 +57,7 @@ class DebugCommand extends AdminCommand ...@@ -57,7 +57,7 @@ class DebugCommand extends AdminCommand
if ($text !== 'glasnost' && ! $chat->isPrivateChat()) { if ($text !== 'glasnost' && ! $chat->isPrivateChat()) {
$data['text'] = 'Only available in a private chat.'; $data['text'] = 'Only available in a private chat.';
return Request::sendMessage($data); return Client::sendMessage($data);
} }
$debug_info = []; $debug_info = [];
...@@ -95,10 +95,10 @@ class DebugCommand extends AdminCommand ...@@ -95,10 +95,10 @@ class DebugCommand extends AdminCommand
$webhook_info_title = '*Webhook Info:*'; $webhook_info_title = '*Webhook Info:*';
try { try {
// Check if we're actually using the Webhook method. // Check if we're actually using the Webhook method.
if (Request::getInput() === '') { if (Client::getInput() === '') {
$debug_info[] = $webhook_info_title . ' `Using getUpdates method, not Webhook.`'; $debug_info[] = $webhook_info_title . ' `Using getUpdates method, not Webhook.`';
} else { } else {
$webhook_info_result = json_decode(Request::getWebhookInfo(), true)['result']; $webhook_info_result = json_decode(Client::getWebhookInfo(), true)['result'];
// Add a human-readable error date string if necessary. // Add a human-readable error date string if necessary.
if (isset($webhook_info_result['last_error_date'])) { if (isset($webhook_info_result['last_error_date'])) {
$webhook_info_result['last_error_date_string'] = date('Y-m-d H:i:s', $webhook_info_result['last_error_date']); $webhook_info_result['last_error_date_string'] = date('Y-m-d H:i:s', $webhook_info_result['last_error_date']);
...@@ -118,6 +118,6 @@ class DebugCommand extends AdminCommand ...@@ -118,6 +118,6 @@ class DebugCommand extends AdminCommand
$data['parse_mode'] = 'Markdown'; $data['parse_mode'] = 'Markdown';
$data['text'] = implode(PHP_EOL, $debug_info); $data['text'] = implode(PHP_EOL, $debug_info);
return Request::sendMessage($data); return Client::sendMessage($data);
} }
} }
...@@ -13,7 +13,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands; ...@@ -13,7 +13,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands;
use Longman\TelegramBot\Commands\AdminCommand; use Longman\TelegramBot\Commands\AdminCommand;
use Longman\TelegramBot\Entities\Message; use Longman\TelegramBot\Entities\Message;
use Longman\TelegramBot\Http\ServerResponse; use Longman\TelegramBot\Http\ServerResponse;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
/** /**
* Admin "/sendtoall" command * Admin "/sendtoall" command
...@@ -60,7 +60,7 @@ class SendtoallCommand extends AdminCommand ...@@ -60,7 +60,7 @@ class SendtoallCommand extends AdminCommand
} }
/** @var ServerResponse[] $results */ /** @var ServerResponse[] $results */
$results = Request::sendToActiveChats( $results = Client::sendToActiveChats(
'sendMessage', //callback function to execute (see Request.php methods) 'sendMessage', //callback function to execute (see Request.php methods)
['text' => $text], //Param to evaluate the request ['text' => $text], //Param to evaluate the request
[ [
......
...@@ -15,7 +15,7 @@ use Longman\TelegramBot\Conversation; ...@@ -15,7 +15,7 @@ use Longman\TelegramBot\Conversation;
use Longman\TelegramBot\Entities\Chat; use Longman\TelegramBot\Entities\Chat;
use Longman\TelegramBot\Entities\Keyboard; use Longman\TelegramBot\Entities\Keyboard;
use Longman\TelegramBot\Entities\Message; use Longman\TelegramBot\Entities\Message;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
class SendtochannelCommand extends AdminCommand class SendtochannelCommand extends AdminCommand
{ {
...@@ -232,7 +232,7 @@ class SendtochannelCommand extends AdminCommand ...@@ -232,7 +232,7 @@ class SendtochannelCommand extends AdminCommand
if (! $text_yes_or_no && $notes['last_message_id'] !== $message->getMessageId()) { if (! $text_yes_or_no && $notes['last_message_id'] !== $message->getMessageId()) {
$data['text'] .= PHP_EOL . 'Type Yes or No'; $data['text'] .= PHP_EOL . 'Type Yes or No';
} }
$result = Request::sendMessage($data); $result = Client::sendMessage($data);
} }
break; break;
} }
...@@ -255,7 +255,7 @@ class SendtochannelCommand extends AdminCommand ...@@ -255,7 +255,7 @@ class SendtochannelCommand extends AdminCommand
} }
$this->conversation->stop(); $this->conversation->stop();
$result = Request::sendMessage($data); $result = Client::sendMessage($data);
} }
return $result; return $result;
...@@ -305,7 +305,7 @@ class SendtochannelCommand extends AdminCommand ...@@ -305,7 +305,7 @@ class SendtochannelCommand extends AdminCommand
$data['longitude'] = $message->getLocation()->getLongitude(); $data['longitude'] = $message->getLocation()->getLongitude();
} }
return Request::send('send' . ucfirst($type), $data); return Client::send('send' . ucfirst($type), $data);
} }
/** /**
......
...@@ -17,7 +17,7 @@ use Longman\TelegramBot\DB; ...@@ -17,7 +17,7 @@ use Longman\TelegramBot\DB;
use Longman\TelegramBot\Entities\Chat; use Longman\TelegramBot\Entities\Chat;
use Longman\TelegramBot\Entities\PhotoSize; use Longman\TelegramBot\Entities\PhotoSize;
use Longman\TelegramBot\Entities\UserProfilePhotos; use Longman\TelegramBot\Entities\UserProfilePhotos;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
/** /**
* Admin "/whois" command * Admin "/whois" command
...@@ -141,7 +141,7 @@ class WhoisCommand extends AdminCommand ...@@ -141,7 +141,7 @@ class WhoisCommand extends AdminCommand
//Code from Whoami command //Code from Whoami command
$limit = 10; $limit = 10;
$offset = null; $offset = null;
$response = Request::getUserProfilePhotos( $response = Client::getUserProfilePhotos(
[ [
'user_id' => $user_id, 'user_id' => $user_id,
'limit' => $limit, 'limit' => $limit,
...@@ -163,7 +163,7 @@ class WhoisCommand extends AdminCommand ...@@ -163,7 +163,7 @@ class WhoisCommand extends AdminCommand
$data['photo'] = $file_id; $data['photo'] = $file_id;
$data['caption'] = $text; $data['caption'] = $text;
return Request::sendPhoto($data); return Client::sendPhoto($data);
} }
} }
} elseif ($chat->isGroupChat()) { } elseif ($chat->isGroupChat()) {
...@@ -182,6 +182,6 @@ class WhoisCommand extends AdminCommand ...@@ -182,6 +182,6 @@ class WhoisCommand extends AdminCommand
$data['text'] = $text; $data['text'] = $text;
return Request::sendMessage($data); return Client::sendMessage($data);
} }
} }
...@@ -16,7 +16,7 @@ use Longman\TelegramBot\Entities\ChosenInlineResult; ...@@ -16,7 +16,7 @@ use Longman\TelegramBot\Entities\ChosenInlineResult;
use Longman\TelegramBot\Entities\InlineQuery; use Longman\TelegramBot\Entities\InlineQuery;
use Longman\TelegramBot\Entities\Message; use Longman\TelegramBot\Entities\Message;
use Longman\TelegramBot\Entities\Update; use Longman\TelegramBot\Entities\Update;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
use Longman\TelegramBot\Telegram; use Longman\TelegramBot\Telegram;
/** /**
...@@ -156,7 +156,7 @@ abstract class Command ...@@ -156,7 +156,7 @@ abstract class Command
$message = $this->getMessage(); $message = $this->getMessage();
if ($user = $message->getFrom()) { if ($user = $message->getFrom()) {
return Request::sendMessage([ return Client::sendMessage([
'chat_id' => $user->getId(), 'chat_id' => $user->getId(),
'parse_mode' => 'Markdown', 'parse_mode' => 'Markdown',
'text' => sprintf( 'text' => sprintf(
...@@ -167,7 +167,7 @@ abstract class Command ...@@ -167,7 +167,7 @@ abstract class Command
]); ]);
} }
return Request::emptyResponse(); return Client::emptyResponse();
} }
return $this->execute(); return $this->execute();
...@@ -198,7 +198,7 @@ abstract class Command ...@@ -198,7 +198,7 @@ abstract class Command
'text' => 'Sorry no database connection, unable to execute "' . $this->name . '" command.', 'text' => 'Sorry no database connection, unable to execute "' . $this->name . '" command.',
]; ];
return Request::sendMessage($data); return Client::sendMessage($data);
} }
/** /**
...@@ -375,7 +375,7 @@ abstract class Command ...@@ -375,7 +375,7 @@ abstract class Command
if (!$chat->isPrivateChat()) { if (!$chat->isPrivateChat()) {
// Delete the falsely called command message. // Delete the falsely called command message.
Request::deleteMessage([ Client::deleteMessage([
'chat_id' => $chat->getId(), 'chat_id' => $chat->getId(),
'message_id' => $message->getMessageId(), 'message_id' => $message->getMessageId(),
]); ]);
...@@ -398,13 +398,13 @@ abstract class Command ...@@ -398,13 +398,13 @@ abstract class Command
public function replyToChat($text, array $data = []) public function replyToChat($text, array $data = [])
{ {
if ($message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost()) { if ($message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost()) {
return Request::sendMessage(array_merge([ return Client::sendMessage(array_merge([
'chat_id' => $message->getChat()->getId(), 'chat_id' => $message->getChat()->getId(),
'text' => $text, 'text' => $text,
], $data)); ], $data));
} }
return Request::emptyResponse(); return Client::emptyResponse();
} }
/** /**
...@@ -418,12 +418,12 @@ abstract class Command ...@@ -418,12 +418,12 @@ abstract class Command
public function replyToUser($text, array $data = []) public function replyToUser($text, array $data = [])
{ {
if ($message = $this->getMessage() ?: $this->getEditedMessage()) { if ($message = $this->getMessage() ?: $this->getEditedMessage()) {
return Request::sendMessage(array_merge([ return Client::sendMessage(array_merge([
'chat_id' => $message->getFrom()->getId(), 'chat_id' => $message->getFrom()->getId(),
'text' => $text, 'text' => $text,
], $data)); ], $data));
} }
return Request::emptyResponse(); return Client::emptyResponse();
} }
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
namespace Longman\TelegramBot\Commands; namespace Longman\TelegramBot\Commands;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
abstract class SystemCommand extends Command abstract class SystemCommand extends Command
{ {
...@@ -25,6 +25,6 @@ abstract class SystemCommand extends Command ...@@ -25,6 +25,6 @@ abstract class SystemCommand extends Command
public function execute() public function execute()
{ {
//System command, return empty ServerResponse by default //System command, return empty ServerResponse by default
return Request::emptyResponse(); return Client::emptyResponse();
} }
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace Longman\TelegramBot\Commands\SystemCommands; namespace Longman\TelegramBot\Commands\SystemCommands;
use Longman\TelegramBot\Commands\SystemCommand; use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
/** /**
* Callback query command * Callback query command
...@@ -56,7 +56,7 @@ class CallbackqueryCommand extends SystemCommand ...@@ -56,7 +56,7 @@ class CallbackqueryCommand extends SystemCommand
$callback($this->getUpdate()->getCallbackQuery()); $callback($this->getUpdate()->getCallbackQuery());
} }
return Request::answerCallbackQuery(['callback_query_id' => $this->getUpdate()->getCallbackQuery()->getId()]); return Client::answerCallbackQuery(['callback_query_id' => $this->getUpdate()->getCallbackQuery()->getId()]);
} }
/** /**
......
...@@ -12,7 +12,7 @@ namespace Longman\TelegramBot\Commands\SystemCommands; ...@@ -12,7 +12,7 @@ namespace Longman\TelegramBot\Commands\SystemCommands;
use Longman\TelegramBot\Commands\SystemCommand; use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Conversation; use Longman\TelegramBot\Conversation;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
/** /**
* Generic message command * Generic message command
...@@ -47,7 +47,7 @@ class GenericmessageCommand extends SystemCommand ...@@ -47,7 +47,7 @@ class GenericmessageCommand extends SystemCommand
public function executeNoDb() public function executeNoDb()
{ {
//Do nothing //Do nothing
return Request::emptyResponse(); return Client::emptyResponse();
} }
/** /**
...@@ -69,6 +69,6 @@ class GenericmessageCommand extends SystemCommand ...@@ -69,6 +69,6 @@ class GenericmessageCommand extends SystemCommand
return $this->telegram->executeCommand($command); return $this->telegram->executeCommand($command);
} }
return Request::emptyResponse(); return Client::emptyResponse();
} }
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace Longman\TelegramBot\Commands\SystemCommands; namespace Longman\TelegramBot\Commands\SystemCommands;
use Longman\TelegramBot\Commands\SystemCommand; use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
/** /**
* Inline query command * Inline query command
...@@ -45,6 +45,6 @@ class InlinequeryCommand extends SystemCommand ...@@ -45,6 +45,6 @@ class InlinequeryCommand extends SystemCommand
//$user_id = $inline_query->getFrom()->getId(); //$user_id = $inline_query->getFrom()->getId();
//$query = $inline_query->getQuery(); //$query = $inline_query->getQuery();
return Request::answerInlineQuery(['inline_query_id' => $this->getUpdate()->getInlineQuery()->getId()]); return Client::answerInlineQuery(['inline_query_id' => $this->getUpdate()->getInlineQuery()->getId()]);
} }
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
namespace Longman\TelegramBot\Entities; namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
/** /**
* Class CallbackQuery. * Class CallbackQuery.
...@@ -46,7 +46,7 @@ class CallbackQuery extends Entity ...@@ -46,7 +46,7 @@ class CallbackQuery extends Entity
*/ */
public function answer(array $data = []) public function answer(array $data = [])
{ {
return Request::answerCallbackQuery(array_merge([ return Client::answerCallbackQuery(array_merge([
'callback_query_id' => $this->getId(), 'callback_query_id' => $this->getId(),
], $data)); ], $data));
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace Longman\TelegramBot\Entities; namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Entities\InlineQuery\InlineQueryResult; use Longman\TelegramBot\Entities\InlineQuery\InlineQueryResult;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
/** /**
* Class InlineQuery * Class InlineQuery
...@@ -47,7 +47,7 @@ class InlineQuery extends Entity ...@@ -47,7 +47,7 @@ class InlineQuery extends Entity
*/ */
public function answer(array $results, array $data = []) public function answer(array $results, array $data = [])
{ {
return Request::answerCallbackQuery(array_merge([ return Client::answerCallbackQuery(array_merge([
'callback_query_id' => $this->getId(), 'callback_query_id' => $this->getId(),
'results' => $results, 'results' => $results,
], $data)); ], $data));
......
...@@ -12,7 +12,7 @@ namespace Longman\TelegramBot\Entities\Payments; ...@@ -12,7 +12,7 @@ namespace Longman\TelegramBot\Entities\Payments;
use Longman\TelegramBot\Entities\Entity; use Longman\TelegramBot\Entities\Entity;
use Longman\TelegramBot\Entities\User; use Longman\TelegramBot\Entities\User;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
/** /**
* Class PreCheckoutQuery * Class PreCheckoutQuery
...@@ -52,7 +52,7 @@ class PreCheckoutQuery extends Entity ...@@ -52,7 +52,7 @@ class PreCheckoutQuery extends Entity
*/ */
public function answer($ok, array $data = []) public function answer($ok, array $data = [])
{ {
return Request::answerPreCheckoutQuery(array_merge([ return Client::answerPreCheckoutQuery(array_merge([
'pre_checkout_query_id' => $this->getId(), 'pre_checkout_query_id' => $this->getId(),
'ok' => $ok, 'ok' => $ok,
], $data)); ], $data));
......
...@@ -12,7 +12,7 @@ namespace Longman\TelegramBot\Entities\Payments; ...@@ -12,7 +12,7 @@ namespace Longman\TelegramBot\Entities\Payments;
use Longman\TelegramBot\Entities\Entity; use Longman\TelegramBot\Entities\Entity;
use Longman\TelegramBot\Entities\User; use Longman\TelegramBot\Entities\User;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
/** /**
* Class ShippingQuery * Class ShippingQuery
...@@ -49,7 +49,7 @@ class ShippingQuery extends Entity ...@@ -49,7 +49,7 @@ class ShippingQuery extends Entity
*/ */
public function answer($ok, array $data = []) public function answer($ok, array $data = [])
{ {
return Request::answerShippingQuery(array_merge([ return Client::answerShippingQuery(array_merge([
'shipping_query_id' => $this->getId(), 'shipping_query_id' => $this->getId(),
'ok' => $ok, 'ok' => $ok,
], $data)); ], $data));
......
This diff is collapsed.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace Longman\TelegramBot\Commands\UserCommands; namespace Longman\TelegramBot\Commands\UserCommands;
use Longman\TelegramBot\Commands\UserCommand; use Longman\TelegramBot\Commands\UserCommand;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
/** /**
* Test "/hidden" command to test $show_in_help * Test "/hidden" command to test $show_in_help
...@@ -51,6 +51,6 @@ class HiddenCommand extends UserCommand ...@@ -51,6 +51,6 @@ class HiddenCommand extends UserCommand
*/ */
public function execute() public function execute()
{ {
return Request::emptyResponse(); return Client::emptyResponse();
} }
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace Longman\TelegramBot\Commands\UserCommands; namespace Longman\TelegramBot\Commands\UserCommands;
use Longman\TelegramBot\Commands\UserCommand; use Longman\TelegramBot\Commands\UserCommand;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
/** /**
* Test "/visible" command to test $show_in_help * Test "/visible" command to test $show_in_help
...@@ -51,6 +51,6 @@ class VisibleCommand extends UserCommand ...@@ -51,6 +51,6 @@ class VisibleCommand extends UserCommand
*/ */
public function execute() public function execute()
{ {
return Request::emptyResponse(); return Client::emptyResponse();
} }
} }
...@@ -14,7 +14,7 @@ namespace Longman\TelegramBot\Tests\Unit; ...@@ -14,7 +14,7 @@ namespace Longman\TelegramBot\Tests\Unit;
use Longman\TelegramBot\Entities\Message; use Longman\TelegramBot\Entities\Message;
use Longman\TelegramBot\Http\ServerResponse; use Longman\TelegramBot\Http\ServerResponse;
use Longman\TelegramBot\Http\Request; use Longman\TelegramBot\Http\Client;
/** /**
* @package TelegramTest * @package TelegramTest
...@@ -259,7 +259,7 @@ class ServerResponseTest extends TestCase ...@@ -259,7 +259,7 @@ class ServerResponseTest extends TestCase
public function testSetGeneralTestFakeResponse() public function testSetGeneralTestFakeResponse()
{ {
//setWebhook ok //setWebhook ok
$fake_response = Request::generateGeneralFakeServerResponse(); $fake_response = Client::generateGeneralFakeServerResponse();
$server = new ServerResponse($fake_response, 'testbot'); $server = new ServerResponse($fake_response, 'testbot');
...@@ -269,7 +269,7 @@ class ServerResponseTest extends TestCase ...@@ -269,7 +269,7 @@ class ServerResponseTest extends TestCase
self::assertEquals('', $server->getDescription()); self::assertEquals('', $server->getDescription());
//sendMessage ok //sendMessage ok
$fake_response = Request::generateGeneralFakeServerResponse(['chat_id' => 123456789, 'text' => 'hello']); $fake_response = Client::generateGeneralFakeServerResponse(['chat_id' => 123456789, 'text' => 'hello']);
$server = new ServerResponse($fake_response, 'testbot'); $server = new ServerResponse($fake_response, 'testbot');
......
...@@ -151,4 +151,13 @@ class TelegramTest extends TestCase ...@@ -151,4 +151,13 @@ class TelegramTest extends TestCase
$this->assertInstanceOf(\Illuminate\Container\Container::class, $telegram); $this->assertInstanceOf(\Illuminate\Container\Container::class, $telegram);
} }
public function testCustom()
{
$telegram = new Telegram(self::$dummy_api_key, 'testbot');
$telegram->handle();
$this->assertTrue(true);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment