예제 #1
0
 /**
  * Terminates the service
  * 
  * @return void
  */
 public function init()
 {
     if (!$this->app->getConfigItem('logger.buffer')) {
         throw new DualityException("Error Config: log_file configuration not found", DualityException::E_CONFIG_NOTFOUND);
     }
     $filename = $this->app->getPath() . DIRECTORY_SEPARATOR . $this->app->getConfigItem('logger.buffer');
     if (!file_exists($filename)) {
         throw new DualityException("Error Config: invalid log_file:" . $filename, DualityException::E_FILE_NOTFOUND);
     }
     $this->stream = new StreamFile($filename);
     $this->stream->open('a+b');
     set_error_handler(array($this, 'error'));
 }
예제 #2
0
 /**
  * Test forbidden file
  * 
  * @expectedException \Duality\Core\DualityException
  */
 public function testForbiddenFile()
 {
     $file = new StreamFile(DATA_PATH . '/forbidden');
     $file->open('w');
 }