1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-06 13:16:39 +02:00

Merge branch '1.x'

This commit is contained in:
Jordi Boggiano
2016-07-29 04:53:49 +02:00
5 changed files with 70 additions and 5 deletions

View File

@@ -13,6 +13,7 @@ namespace Monolog\Handler;
use Monolog\Test\TestCase;
use Monolog\Logger;
use Monolog\Formatter\LineFormatter;
/**
* @author Greg Kedzierski <greg@gregkedzierski.com>
@@ -57,6 +58,23 @@ class SlackHandlerTest extends TestCase
$this->assertRegexp('/token=myToken&channel=channel1&username=Monolog&text=&attachments=.*$/', $content);
}
public function testWriteContentUsesFormatterIfProvided()
{
$this->createHandler('myToken', 'channel1', 'Monolog', false);
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
fseek($this->res, 0);
$content = fread($this->res, 1024);
$this->createHandler('myToken', 'channel1', 'Monolog', false);
$this->handler->setFormatter(new LineFormatter('foo--%message%'));
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test2'));
fseek($this->res, 0);
$content2 = fread($this->res, 1024);
$this->assertRegexp('/token=myToken&channel=channel1&username=Monolog&text=test1.*$/', $content);
$this->assertRegexp('/token=myToken&channel=channel1&username=Monolog&text=foo--test2.*$/', $content2);
}
public function testWriteContentWithEmoji()
{
$this->createHandler('myToken', 'channel1', 'Monolog', true, 'alien');