@@ -35,6 +35,18 @@ public function testWriteHeader()
3535 return $ content ;
3636 }
3737
38+ public function testWriteCustomHostHeader ()
39+ {
40+ $ this ->createHandler ('myToken ' , 'room1 ' , 'Monolog ' , false , 'hipchat.foo.bar ' );
41+ $ this ->handler ->handle ($ this ->getRecord (Logger::CRITICAL , 'test1 ' ));
42+ fseek ($ this ->res , 0 );
43+ $ content = fread ($ this ->res , 1024 );
44+
45+ $ 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 );
46+
47+ return $ content ;
48+ }
49+
3850 /**
3951 * @depends testWriteHeader
4052 */
@@ -129,9 +141,9 @@ public function provideBatchRecords()
129141 );
130142 }
131143
132- private function createHandler ($ token = 'myToken ' , $ room = 'room1 ' , $ name = 'Monolog ' , $ notify = false )
144+ private function createHandler ($ token = 'myToken ' , $ room = 'room1 ' , $ name = 'Monolog ' , $ notify = false , $ host = ' api.hipchat.com ' )
133145 {
134- $ constructorArgs = array ($ token , $ room , $ name , $ notify , Logger::DEBUG );
146+ $ constructorArgs = array ($ token , $ room , $ name , $ notify , Logger::DEBUG , true , true , ' text ' , $ host );
135147 $ this ->res = fopen ('php://memory ' , 'a ' );
136148 $ this ->handler = $ this ->getMock (
137149 '\Monolog\Handler\HipChatHandler ' ,
0 commit comments