public function testWrite() { $GLOBALS["socket"] = array(); $this->mockFunction('fsockopen', function ($host, $port, &$errorCode, &$errorMessage, $delay) { $GLOBALS['socket'][] = func_get_args(); return 'SocketMock'; }); $this->mockFunction('fwrite', function () { $GLOBALS['socket'][] = func_get_args(); return true; }); $this->mockFunction('fclose', function () { $GLOBALS['socket'][] = func_get_args(); return true; }); $appender = new LoggerAppenderSocket('8.8.8.8', 80, 10); $appender->write(Logger::INFO, 'test'); $this->assertEquals(array(array('8.8.8.8', 80, null, null, 10), array("SocketMock", 'test'), array('SocketMock')), $GLOBALS["socket"]); }