1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-03-14 15:49:39 +01:00

Fixed HipChat tests

This commit is contained in:
Jannik Zschiesche 2015-11-18 10:25:09 +01:00
parent fa38530fdc
commit 538349c4c4

View File

@ -21,6 +21,7 @@ use Monolog\Logger;
class HipChatHandlerTest extends TestCase
{
private $res;
/** @var HipChatHandler */
private $handler;
public function testWriteHeader()
@ -91,6 +92,18 @@ class HipChatHandlerTest extends TestCase
$this->assertRegexp('/notify=0&message=test1&message_format=text&color=red&room_id=room1&from=Monolog$/', $content);
}
public function testWriteContentV1WithoutName()
{
$this->createHandler('myToken', 'room1', null, false, 'hipchat.foo.bar', 'v1');
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
fseek($this->res, 0);
$content = fread($this->res, 1024);
$this->assertRegexp('/notify=0&message=test1&message_format=text&color=red&room_id=room1&from=$/', $content);
return $content;
}
/**
* @depends testWriteCustomHostHeader
*/
@ -104,7 +117,7 @@ class HipChatHandlerTest extends TestCase
*/
public function testWriteContentV2($content)
{
$this->assertRegexp('/notify=false&message=test1&message_format=text&color=red$/', $content);
$this->assertRegexp('/notify=false&message=test1&message_format=text&color=red&from=Monolog$/', $content);
}
/**
@ -112,7 +125,19 @@ class HipChatHandlerTest extends TestCase
*/
public function testWriteContentV2Notify($content)
{
$this->assertRegexp('/notify=true&message=test1&message_format=text&color=red$/', $content);
$this->assertRegexp('/notify=true&message=test1&message_format=text&color=red&from=Monolog$/', $content);
}
public function testWriteContentV2WithoutName()
{
$this->createHandler('myToken', 'room1', null, false, 'hipchat.foo.bar', 'v2');
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
fseek($this->res, 0);
$content = fread($this->res, 1024);
$this->assertRegexp('/notify=false&message=test1&message_format=text&color=red$/', $content);
return $content;
}
public function testWriteWithComplexMessage()