1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 17:16:18 +02:00
Files
php-monolog/tests/Monolog/Handler/TelegramBotHandlerTest.php
2019-07-05 19:15:10 +03:00

42 lines
1014 B
PHP

<?php
namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\Test\TestCase;
/**
* @author Mazur Alexandr <alexandrmazur96@gmail.com>
* @link https://core.telegram.org/bots/api
*/
class TelegramBotHandlerTest extends TestCase
{
/**
* @var TelegramBotHandler
*/
private $handler;
public function testSendTelegramRequest(): void
{
$this->createHandler();
$this->handler->handle($this->getRecord());
}
/**
* @param string $apiKey
* @param string $channel
*/
private function createHandler(string $apiKey = 'testKey', string $channel = 'testChannel'): void
{
$constructorArgs = [$apiKey, $channel, Logger::DEBUG, true];
$this->handler = $this->getMockBuilder(TelegramBotHandler::class)
->setConstructorArgs($constructorArgs)
->setMethods(['send'])
->getMock();
$this->handler->expects($this->atLeast(1))
->method('send')
->willReturn(null);
}
}