/** * @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)); }
/** * @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); }