Beispiel #1
0
 /**
  * testMoveWithSkip method
  *
  * Verify that directories and files are moved recursively
  * even if the destination directory already exists.
  * Subdirectories existing in both destination and source directory
  * are skipped and not merged or overwritten.
  *
  * @return void
  */
 public function testMoveWithSkip()
 {
     extract($this->_setupFilesystem());
     $Folder = new Folder($folderOne);
     $result = $Folder->move(array('to' => $folderTwo, 'scheme' => Folder::SKIP));
     $this->assertTrue($result);
     $this->assertTrue(file_exists($folderTwo . '/file1.php'));
     $this->assertTrue(is_dir($folderTwo . '/folderB'));
     $this->assertTrue(file_exists($folderTwoB . '/fileB.php'));
     $this->assertFalse(file_exists($fileOne));
     $this->assertFalse(file_exists($folderOneA));
     $this->assertFalse(file_exists($fileOneA));
     $Folder = new Folder($folderTwo);
     $Folder->delete();
     new Folder($folderOne, true);
     new Folder($folderOneA, true);
     new Folder($folderTwo, true);
     touch($fileOne);
     touch($fileOneA);
     $Folder = new Folder($folderOne);
     $result = $Folder->move(array('to' => $folderTwo, 'scheme' => Folder::SKIP));
     $this->assertTrue($result);
     $this->assertTrue(file_exists($folderTwo . '/file1.php'));
     $this->assertTrue(is_dir($folderTwo . '/folderA'));
     $this->assertTrue(file_exists($folderTwo . '/folderA/fileA.php'));
     $this->assertFalse(file_exists($fileOne));
     $this->assertFalse(file_exists($folderOneA));
     $this->assertFalse(file_exists($fileOneA));
     $Folder = new Folder($folderTwo);
     $Folder->delete();
     new Folder($folderOne, true);
     new Folder($folderOneA, true);
     new Folder($folderTwo, true);
     new Folder($folderTwoB, true);
     touch($fileOne);
     touch($fileOneA);
     file_put_contents($folderTwoB . '/fileB.php', 'untouched');
     $Folder = new Folder($folderOne);
     $result = $Folder->move(array('to' => $folderTwo, 'scheme' => Folder::SKIP));
     $this->assertTrue($result);
     $this->assertTrue(file_exists($folderTwo . '/file1.php'));
     $this->assertEquals('untouched', file_get_contents($folderTwoB . '/fileB.php'));
     $this->assertFalse(file_exists($fileOne));
     $this->assertFalse(file_exists($folderOneA));
     $this->assertFalse(file_exists($fileOneA));
     $Folder = new Folder($path);
     $Folder->delete();
 }