private function createHandler($token = 'myToken', $room = 'room1', $name = 'Monolog', $notify = false, $host = 'api.hipchat.com', $version = 'v1') { $constructorArgs = array($token, $room, $name, $notify, Logger::DEBUG, true, true, 'text', $host, $version); $this->res = fopen('php://memory', 'a'); $this->handler = $this->getMock('\\Monolog\\Handler\\HipChatHandler', array('fsockopen', 'streamSetTimeout', 'closeSocket'), $constructorArgs); $reflectionProperty = new \ReflectionProperty('\\Monolog\\Handler\\SocketHandler', 'connectionString'); $reflectionProperty->setAccessible(true); $reflectionProperty->setValue($this->handler, 'localhost:1234'); $this->handler->expects($this->any())->method('fsockopen')->will($this->returnValue($this->res)); $this->handler->expects($this->any())->method('streamSetTimeout')->will($this->returnValue(true)); $this->handler->expects($this->any())->method('closeSocket')->will($this->returnValue(true)); $this->handler->setFormatter($this->getIdentityFormatter()); }
/** * GuzzleHipChatHandler constructor. * * @param Client $client * @param string $token * @param string $room * @param string $name * @param bool $notify * @param bool|int $level * @param bool $bubble * @param bool $useSSL * @param string $format * @param string $host * @param string $version */ public function __construct(Client $client, $token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $format = 'text', $host = 'api.hipchat.com', $version = self::API_V1) { parent::__construct($token, $room, $name, $notify, $level, $bubble, $useSSL, $format, $host, $version); $this->protocol = $useSSL ? 'https://' : 'http://'; $this->client = $client; }