5 require_once
'Sabre/TestUtil.php';
14 mkdir(SABRE_TEMPDIR .
'/root');
15 mkdir(SABRE_TEMPDIR .
'/root/subdir');
16 file_put_contents(SABRE_TEMPDIR .
'/root/file.txt',
'contents');
17 file_put_contents(SABRE_TEMPDIR .
'/root/subdir/subfile.txt',
'subcontents');
19 $this->tree =
new Tree($rootNode);
31 $root = $this->tree->getNodeForPath(
'');
32 $this->assertInstanceOf(
'Sabre\\DAV\\FSExt\\Directory',
$root);
38 $root = $this->tree->getNodeForPath(
'subdir');
39 $this->assertInstanceOf(
'Sabre\\DAV\\FSExt\\Directory',
$root);
45 $this->tree->copy(
'file.txt',
'file2.txt');
46 $this->assertTrue(file_exists(SABRE_TEMPDIR .
'/root/file2.txt'));
47 $this->assertEquals(
'contents', file_get_contents(SABRE_TEMPDIR .
'/root/file2.txt'));
56 $this->tree->copy(
'subdir',
'subdir2');
57 $this->assertTrue(file_exists(SABRE_TEMPDIR .
'/root/subdir2'));
58 $this->assertTrue(file_exists(SABRE_TEMPDIR .
'/root/subdir2/subfile.txt'));
59 $this->assertEquals(
'subcontents', file_get_contents(SABRE_TEMPDIR .
'/root/subdir2/subfile.txt'));
68 $this->tree->move(
'file.txt',
'file2.txt');
69 $this->assertTrue(file_exists(SABRE_TEMPDIR .
'/root/file2.txt'));
70 $this->assertFalse(file_exists(SABRE_TEMPDIR .
'/root/file.txt'));
71 $this->assertEquals(
'contents', file_get_contents(SABRE_TEMPDIR .
'/root/file2.txt'));
80 $this->tree->move(
'file.txt',
'subdir/file2.txt');
81 $this->assertTrue(file_exists(SABRE_TEMPDIR .
'/root/subdir/file2.txt'));
82 $this->assertFalse(file_exists(SABRE_TEMPDIR .
'/root/file.txt'));
83 $this->assertEquals(
'contents', file_get_contents(SABRE_TEMPDIR .
'/root/subdir/file2.txt'));
92 $this->tree->move(
'subdir',
'subdir2');
93 $this->assertTrue(file_exists(SABRE_TEMPDIR .
'/root/subdir2'));
94 $this->assertTrue(file_exists(SABRE_TEMPDIR .
'/root/subdir2/subfile.txt'));
95 $this->assertFalse(file_exists(SABRE_TEMPDIR .
'/root/subdir'));
96 $this->assertEquals(
'subcontents', file_get_contents(SABRE_TEMPDIR .
'/root/subdir2/subfile.txt'));
testMoveFile()
testCopyFile
testMoveFileNewParent()
testMoveFile
testMoveDirectory()
testCopyDirectory
testCopyDirectory()
testCopyFile
The tree object is responsible for basic tree operations.
static clearTempDir()
This function deletes all the contents of the temporary directory.