예제 #1
0
 /**
  * @coverage Desarrolla2\File\File::read
  * @coverage Desarrolla2\File\File::write
  */
 public function testWriteAndRead()
 {
     $fileName = sys_get_temp_dir() . '/' . uniqid(true) . '.php.test';
     $data = uniqid(true);
     File::write($fileName, $data);
     $this->assertEquals($data, File::read($fileName));
 }
예제 #2
0
파일: Json.php 프로젝트: desarrolla2/file
 /**
  * @param string $fileName
  * @param array  $data
  *
  * @throws RuntimeException
  */
 public static function write($fileName, $data, $mode = 'w')
 {
     $json = json_encode($data, JSON_PRETTY_PRINT);
     if (json_last_error()) {
         throw new \RuntimeException(json_last_error_msg());
     }
     parent::write($fileName, $json, $mode);
 }