Exemple #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));
 }
Exemple #2
0
 /**
  * @param string $fileName
  *
  * @return array
  * @throws RuntimeException
  */
 public static function read($fileName)
 {
     $data = parent::read($fileName);
     $json = json_decode($data, true);
     if (json_last_error()) {
         throw new \RuntimeException(json_last_error_msg());
     }
     return $json;
 }