Exemplo n.º 1
0
 public function testCopyDirectoryMovesEntireDirectory()
 {
     $this->root->addChild(new vfsStreamDirectory('tmp'));
     $this->root->addChild(new vfsStreamDirectory('tmp2'));
     $dir = $this->root->getChild('tmp');
     $temp2 = $this->root->getChild('tmp2');
     vfsStream::newFile('foo.txt')->withContent('foo')->at($dir);
     vfsStream::newFile('bar.txt')->withContent('bar')->at($dir);
     $dir->addChild(new vfsStreamDirectory('nested'));
     $dir2 = $dir->getChild('nested');
     vfsStream::newFile('baz.txt')->withContent('baz')->at($dir2);
     $this->files->copyDirectory($dir->url(), $temp2->url());
     $this->assertTrue(is_dir(vfsStream::url('root/tmp2')));
     $this->assertFileExists(vfsStream::url('root/tmp2') . '/foo.txt');
     $this->assertFileExists(vfsStream::url('root/tmp2') . '/bar.txt');
     $this->assertTrue(is_dir(vfsStream::url('root/tmp2') . '/nested'));
     $this->assertFileExists(vfsStream::url('root/tmp2') . '/nested/baz.txt');
 }