11 $this->assertTrue(
$tree->nodeExists(
'hi'));
12 $this->assertFalse(
$tree->nodeExists(
'hello'));
19 $tree->copy(
'hi',
'hi2');
21 $this->assertArrayHasKey(
'hi2',
$tree->getNodeForPath(
'')->newDirectories);
22 $this->assertEquals(
'foobar',
$tree->getNodeForPath(
'hi/file')->get());
23 $this->assertEquals([
'test1' =>
'value'],
$tree->getNodeForPath(
'hi/file')->getProperties([]));
30 $tree->move(
'hi',
'hi2');
32 $this->assertEquals(
'hi2',
$tree->getNodeForPath(
'hi')->getName());
33 $this->assertTrue(
$tree->getNodeForPath(
'hi')->isRenamed);
40 $tree->move(
'hi/sub',
'hi2');
42 $this->assertArrayHasKey(
'hi2',
$tree->getNodeForPath(
'')->newDirectories);
43 $this->assertTrue(
$tree->getNodeForPath(
'hi/sub')->isDeleted);
51 $this->assertTrue(
$tree->getNodeForPath(
'hi')->isDeleted);
58 $children =
$tree->getChildren(
'');
59 $this->assertEquals(2, count($children));
60 $this->assertEquals(
'hi', $children[0]->getName());
67 $result =
$tree->getMultipleNodes([
'hi/sub',
'hi/file']);
68 $this->assertArrayHasKey(
'hi/sub',
$result);
69 $this->assertArrayHasKey(
'hi/file',
$result);
71 $this->assertEquals(
'sub',
$result[
'hi/sub']->getName());
72 $this->assertEquals(
'file',
$result[
'hi/file']->getName());
78 $result =
$tree->getMultipleNodes([
'multi/1',
'multi/2']);
79 $this->assertArrayHasKey(
'multi/1',
$result);
80 $this->assertArrayHasKey(
'multi/2',
$result);
93 $file->properties = [
'test1' =>
'value'];
94 $file->data =
'foobar';
123 $this->newDirectories[
$name] =
true;
135 if (isset($this->newDirectories[
$name]))
return new self(
$name);
137 return parent::getChild(
$name);
149 $this->isDeleted =
true;
155 $this->isRenamed =
true;
An exception for terminatinating execution or to throw for unit testing.
This class represents a set of properties that are going to be updated.
setRemainingResultCode($resultCode)
Sets the result code for all properties that did not have a result yet.
getMutations()
Returns the full list of mutations.
createFile($name, $data=null)
Creates a new file in the directory.
childExists($name)
Checks is a child-node exists.
setName($name)
Renames the node.
createDirectory($name)
Creates a new subdirectory.
getChild($name)
Returns a child object, by its name.
getName()
Returns the name of the node.
propPatch(PropPatch $propPatch)
Updates properties on this node.
getProperties($properties)
Returns a list of properties for this nodes.
__construct($name, $data=null)
getMultipleChildren(array $paths)
This method receives a list of paths in it's first argument.
The tree object is responsible for basic tree operations.