mirror of
https://github.com/Seldaek/monolog.git
synced 2025-02-24 15:02:28 +01:00
Added a new test for Emoji, reverted old tests
This commit is contained in:
parent
ff6c458260
commit
e4e60821b3
@ -54,7 +54,17 @@ class SlackHandlerTest extends TestCase
|
|||||||
fseek($this->res, 0);
|
fseek($this->res, 0);
|
||||||
$content = fread($this->res, 1024);
|
$content = fread($this->res, 1024);
|
||||||
|
|
||||||
$this->assertRegexp('/token=myToken&channel=channel1&username=Monolog&text=&attachments=.*&icon_emoji=%3Aalien%3A$/', $content);
|
$this->assertRegexp('/token=myToken&channel=channel1&username=Monolog&text=&attachments=.*/', $content);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testWriteContentWithEmoji()
|
||||||
|
{
|
||||||
|
$this->createHandler('myToken', 'channel1', 'Monolog', true, 'alien');
|
||||||
|
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
|
||||||
|
fseek($this->res, 0);
|
||||||
|
$content = fread($this->res, 1024);
|
||||||
|
|
||||||
|
$this->assertRegexp('/icon_emoji=%3Aalien%3A$/', $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,7 +82,7 @@ class SlackHandlerTest extends TestCase
|
|||||||
|
|
||||||
public function testWriteContentWithPlainTextMessage()
|
public function testWriteContentWithPlainTextMessage()
|
||||||
{
|
{
|
||||||
$this->createHandler('myToken', 'channel1', 'Monolog', 'alien', false);
|
$this->createHandler('myToken', 'channel1', 'Monolog', false);
|
||||||
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
|
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
|
||||||
fseek($this->res, 0);
|
fseek($this->res, 0);
|
||||||
$content = fread($this->res, 1024);
|
$content = fread($this->res, 1024);
|
||||||
@ -94,7 +104,7 @@ class SlackHandlerTest extends TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createHandler($token = 'myToken', $channel = 'channel1', $username = 'Monolog', $iconEmoji = 'alien', $useAttachment = true)
|
private function createHandler($token = 'myToken', $channel = 'channel1', $username = 'Monolog', $useAttachment = true, $iconEmoji = null)
|
||||||
{
|
{
|
||||||
$constructorArgs = array($token, $channel, $username, $useAttachment, Logger::DEBUG, true, $iconEmoji);
|
$constructorArgs = array($token, $channel, $username, $useAttachment, Logger::DEBUG, true, $iconEmoji);
|
||||||
$this->res = fopen('php://memory', 'a');
|
$this->res = fopen('php://memory', 'a');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user