mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-16 10:04:14 +02:00
Telegram Handler: support additional API parameters (#1451)
This commit is contained in:
@@ -35,9 +35,15 @@ class TelegramBotHandlerTest extends TestCase
|
||||
* @param string $apiKey
|
||||
* @param string $channel
|
||||
*/
|
||||
private function createHandler(string $apiKey = 'testKey', string $channel = 'testChannel'): void
|
||||
private function createHandler(
|
||||
string $apiKey = 'testKey',
|
||||
string $channel = 'testChannel',
|
||||
string $parseMode = 'Markdown',
|
||||
bool $disableWebPagePreview = false,
|
||||
bool $disableNotification = true
|
||||
): void
|
||||
{
|
||||
$constructorArgs = [$apiKey, $channel, Logger::DEBUG, true];
|
||||
$constructorArgs = [$apiKey, $channel, Logger::DEBUG, true, $parseMode, $disableWebPagePreview, $disableNotification];
|
||||
|
||||
$this->handler = $this->getMockBuilder(TelegramBotHandler::class)
|
||||
->setConstructorArgs($constructorArgs)
|
||||
@@ -47,4 +53,18 @@ class TelegramBotHandlerTest extends TestCase
|
||||
$this->handler->expects($this->atLeast(1))
|
||||
->method('send');
|
||||
}
|
||||
|
||||
public function testSetInvalidParseMode(): void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
||||
$handler = new TelegramBotHandler('testKey', 'testChannel');
|
||||
$handler->setParseMode('invalid parse mode');
|
||||
}
|
||||
|
||||
public function testSetParseMode(): void
|
||||
{
|
||||
$handler = new TelegramBotHandler('testKey', 'testChannel');
|
||||
$handler->setParseMode('HTML');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user