Example #1
0
 public function moveTo($destination)
 {
     Filesystem::checkWritable(dirname($destination));
     if (!move_uploaded_file($this->path, $destination)) {
         throw new FilesystemException("Failed to move file {$this->path} to {$destination}");
     }
 }
Example #2
0
 public function putContents($contents)
 {
     if (file_exists($this->path)) {
         Filesystem::checkWritable($this->path);
     } else {
         Filesystem::checkWritable(dirname($this->path));
     }
     file_put_contents($this->path, $contents);
 }
Example #3
0
 public static function checkWriteSafety($path)
 {
     Filesystem::checkExists($path);
     Filesystem::checkWritable($path);
 }
Example #4
0
 /**
  * @expectedException \ntentan\utils\exceptions\FilesystemException
  */
 public function testWriteableException()
 {
     $this->assertEquals(true, Filesystem::checkWritable(vfsStream::url('fs/file')));
     $this->file->chmod(00);
     Filesystem::checkWritable(vfsStream::url('fs/file'));
 }