/** * Updates access date and time on a file * If the file does not exist, it gets created * @return File * @throws CreateDirectoryException * @throws NotWritableException */ public function touch() { $baseDir = new Directory(dirname($this)); if (!FileSystemHelper::isDirectory($baseDir)) { try { $baseDir->create(false); } catch (CreateDirectoryException $e) { throw $e; } } if (!FileSystemHelper::isWritable($baseDir)) { throw new NotWritableException($this); } touch($this); return $this; }
/** * @covers Corgi\File\Helpers\FileSystemHelper::isWritable */ public function testIsWritable() { $this->assertBool(FileSystemHelper::isWritable()); }