logfile = Pluf::f('pluf_log_file', Pluf::f('tmp_folder', '/tmp').'/pluf.log'); @unlink($this->logfile); } function tearDown() { @unlink($this->logfile); } function testSimple() { $GLOBALS['_PX_config']['log_delayed'] = true; Pluf_Log::log('hello'); $this->assertEqual(count(Pluf_Log::$stack), 1); $GLOBALS['_PX_config']['log_delayed'] = false; Pluf_Log::log('hello'); $this->assertEqual(count(Pluf_Log::$stack), 0); $this->assertEqual(2, count(file($this->logfile))); } function testAssertLog() { Pluf_Log::activeAssert(); $GLOBALS['_PX_config']['log_delayed'] = true; assert('Pluf_Log::alog("hello")'); $this->assertEqual(count(Pluf_Log::$stack), 1); $GLOBALS['_PX_config']['log_delayed'] = false; assert('Pluf_Log::alog("hello")'); $this->assertEqual(count(Pluf_Log::$stack), 0); $this->assertEqual(2, count(file($this->logfile))); } /** function testPerformance() { $start = microtime(true); $GLOBALS['_PX_config']['log_delayed'] = false; for ($i=0;$i<100;$i++) { Pluf_Log::log('hello'.$i); } $end = microtime(true); print "File: ".($end-$start)."s\n"; $start = microtime(true); $GLOBALS['_PX_config']['log_delayed'] = true; for ($i=0;$i<100;$i++) { Pluf_Log::log('hello'.$i); } Pluf_Log::flush(); $end = microtime(true); print "File delayed: ".($end-$start)."s\n"; } **/ }