Exemplo n.º 1
0
 /**
  * Renames / moves a file.
  *
  * @param  string  $source Source file name
  * @param  string  $destination Target file name
  * @param  boolean $overwrite TRUE to overrides destination file if it exists
  * @return boolean TRUE if move succeeds
  */
 public function move($source, $destination, $overwrite = false)
 {
     if (!$this->exists($source)) {
         return false;
     }
     if ($this->exists($destination) && !$overwrite) {
         return false;
     }
     // make sure the directory exists!
     $dir = new Directories();
     $dir->mkdir(dirname($destination));
     return @rename($source, $destination);
 }
Exemplo n.º 2
0
 public function testChmod()
 {
     $dir = new Dir();
     mkdir(TESTDIR);
     // checking readability
     $this->assertTrue($dir->isReadable(TESTDIR));
     // changing mode
     $this->assertTrue($dir->chmod(TESTDIR, 0100));
     // checking readability
     $this->assertFalse($dir->isReadable(TESTDIR));
 }