コード例 #1
0
ファイル: LocalDirectoryTest.php プロジェクト: bapcat/persist
 public function testCopyNonEmptyDir()
 {
     $to_copy = new LocalDirectory($this->driver, basename($this->datadir) . '/ne-to-copy');
     $copied = new LocalDirectory($this->driver, basename($this->datadir) . '/ne-copied');
     $child = new LocalFile($this->driver, $to_copy->path . '/child');
     $moved_child = new LocalFile($this->driver, $copied->path . '/child');
     $child_dir = new LocalDirectory($this->driver, $to_copy->path . '/child-dir');
     $moved_child_dir = new LocalDirectory($this->driver, $copied->path . '/child-dir');
     $this->assertFalse($copied->exists);
     $to_copy->create();
     $child->create();
     $child_dir->create();
     $this->assertTrue($to_copy->copy($copied));
     $this->assertTrue($to_copy->exists);
     $this->assertTrue($copied->exists);
     $this->assertTrue($child->exists);
     $this->assertTrue($moved_child->exists);
     $this->assertTrue($child_dir->exists);
     $this->assertTrue($moved_child_dir->exists);
 }
コード例 #2
0
ファイル: LocalFileTest.php プロジェクト: bapcat/persist
 public function testCopy()
 {
     $to_copy = new LocalFile($this->driver, "{$this->filename}-to-copy");
     $copied = new LocalFile($this->driver, "{$this->filename}-copied");
     $this->assertFalse($copied->exists);
     $to_copy->create();
     $this->assertTrue($to_copy->copy($copied));
     $this->assertTrue($to_copy->exists);
     $this->assertTrue($copied->exists);
 }