root = vfsStream::setup('logs/'); Configuration::getInstance()->logfile_location = vfsStream::url('logs/'); $this->logger = new FileLogger; } public function testFileLoggerWritesLogInfo() { $this->logger->log('foo'); $logfile_content = $this->root->getChild('eseye.log')->getContent(); $this->assertContains('eseye.INFO: foo', $logfile_content); } public function testFileLoggerSkipWritesLogDebugWithoutRequiredLevel() { $this->logger->debug('foo'); $logfile_content = $this->root->getChild('eseye.log'); $this->assertNull($logfile_content); } public function testFileLoggerWritesLogDebug() { Configuration::getInstance()->logger_level = 'debug'; // Init a new logger with the updated config $logger = new FileLogger; $logger->debug('foo'); $logfile_content = $this->root->getChild('eseye.log')->getContent(); $this->assertContains('eseye.DEBUG: foo', $logfile_content); } public function testFileLoggerWritesLogWarning() { $this->logger->warning('foo'); $logfile_content = $this->root->getChild('eseye.log')->getContent(); $this->assertContains('eseye.WARNING: foo', $logfile_content); } public function testFileLoggerWritesLogError() { $this->logger->error('foo'); $logfile_content = $this->root->getChild('eseye.log')->getContent(); $this->assertContains('eseye.ERROR: foo', $logfile_content); } }