Пример #1
0
 public function testLogs()
 {
     //Initialize a File object locally
     $fileObj = new \erdiko\core\datasource\File();
     $logFolder = \ROOT . "/var/logs";
     $sampleText = "This is a sample log for Erdiko class test";
     /**
      *	First test
      *
      *  Log a regular message
      */
     Erdiko::log($sampleText);
     $return = $fileObj->read("system.log", $logFolder);
     $this->assertTrue(strpos($return, $sampleText) !== false);
     /**
      *	First test
      *
      *  Log a exception message
      */
     $sampleText = "This is a sample EXCEPTION log for Erdiko class test";
     Erdiko::log($sampleText, null, 'exception');
     $return = $fileObj->read("exception.log", $logFolder);
     $this->assertTrue(strpos($return, $sampleText) !== false);
     //Clean up
     $fileObj->delete("system.log", $logFolder);
     $fileObj->delete("exception.log", $logFolder);
 }
Пример #2
0
 public static function renameFile($oldName, $newName, $path = null)
 {
     $fileObj = new \erdiko\core\datasource\File();
     return $fileObj->rename($oldName, $newName, $path);
 }