mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-05 12:47:39 +02:00
bugfix: use custom hipchat server in buildHeader method
This commit is contained in:
@@ -35,6 +35,18 @@ class HipChatHandlerTest extends TestCase
|
|||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testWriteCustomHostHeader()
|
||||||
|
{
|
||||||
|
$this->createHandler('myToken', 'room1', 'Monolog', false, 'hipchat.foo.bar');
|
||||||
|
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
|
||||||
|
fseek($this->res, 0);
|
||||||
|
$content = fread($this->res, 1024);
|
||||||
|
|
||||||
|
$this->assertRegexp('/POST \/v1\/rooms\/message\?format=json&auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @depends testWriteHeader
|
* @depends testWriteHeader
|
||||||
*/
|
*/
|
||||||
@@ -129,9 +141,9 @@ class HipChatHandlerTest extends TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createHandler($token = 'myToken', $room = 'room1', $name = 'Monolog', $notify = false)
|
private function createHandler($token = 'myToken', $room = 'room1', $name = 'Monolog', $notify = false, $host = 'api.hipchat.com')
|
||||||
{
|
{
|
||||||
$constructorArgs = array($token, $room, $name, $notify, Logger::DEBUG);
|
$constructorArgs = array($token, $room, $name, $notify, Logger::DEBUG, true, true, 'text', $host);
|
||||||
$this->res = fopen('php://memory', 'a');
|
$this->res = fopen('php://memory', 'a');
|
||||||
$this->handler = $this->getMock(
|
$this->handler = $this->getMock(
|
||||||
'\Monolog\Handler\HipChatHandler',
|
'\Monolog\Handler\HipChatHandler',
|
||||||
|
Reference in New Issue
Block a user