mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-11 07:34:12 +02:00
Add plain text message support
This commit is contained in:
@@ -54,7 +54,7 @@ class SlackHandlerTest extends TestCase
|
||||
fseek($this->res, 0);
|
||||
$content = fread($this->res, 1024);
|
||||
|
||||
$this->assertRegexp('/token=myToken&channel=channel1&username=Monolog&attachments=.*$/', $content);
|
||||
$this->assertRegexp('/token=myToken&channel=channel1&username=Monolog&text=&attachments=.*$/', $content);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,6 +70,16 @@ class SlackHandlerTest extends TestCase
|
||||
$this->assertRegexp('/color%22%3A%22'.$expectedColor.'/', $content);
|
||||
}
|
||||
|
||||
public function testWriteContentWithPlainTextMessage()
|
||||
{
|
||||
$this->createHandler('myToken', 'channel1', 'Monolog', false);
|
||||
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
|
||||
fseek($this->res, 0);
|
||||
$content = fread($this->res, 1024);
|
||||
|
||||
$this->assertRegexp('/text=test1/', $content);
|
||||
}
|
||||
|
||||
public function provideLevelColors()
|
||||
{
|
||||
return array(
|
||||
@@ -84,9 +94,9 @@ class SlackHandlerTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
private function createHandler($token = 'myToken', $channel = 'channel1', $username = 'Monolog')
|
||||
private function createHandler($token = 'myToken', $channel = 'channel1', $username = 'Monolog', $useAttachment = true)
|
||||
{
|
||||
$constructorArgs = array($token, $channel, $username, Logger::DEBUG);
|
||||
$constructorArgs = array($token, $channel, $username, Logger::DEBUG, true, $useAttachment);
|
||||
$this->res = fopen('php://memory', 'a');
|
||||
$this->handler = $this->getMock(
|
||||
'\Monolog\Handler\SlackHandler',
|
||||
|
Reference in New Issue
Block a user