19 declare(strict_types=1);
29 protected function setUp(): void
36 $node1 = $this->createMock(ilSimpleFilePathNode::class);
37 $node1->expects($this->any())->method(
'toString')->willReturn(
'Node1');
38 $node1->expects($this->any())->method(
'requiresPathSeparator')->willReturn(
true);
39 $node2 = $this->createMock(ilSimpleFilePathNode::class);
40 $node2->expects($this->any())->method(
'toString')->willReturn(
'Node2');
41 $node2->expects($this->any())->method(
'requiresPathSeparator')->willReturn(
true);
42 $node3 = $this->createMock(ilSimpleFilePathNode::class);
43 $node3->expects($this->any())->method(
'toString')->willReturn(
'Node3');
44 $node3->expects($this->any())->method(
'requiresPathSeparator')->willReturn(
true);
45 $nodes = [$node1, $node2, $node3];
47 $path =
new ilFilePathHandler();
53 ->withStartAtRoot(
true);
54 $sub_path =
$path->subPath(1);
55 $sub_path2 =
$path->subPath(0, 2);
57 $this->assertCount(3,
$path);
58 $this->assertEquals(
'//Node1/Node2/Node3',
$path->toString());
59 $this->assertEquals(
'/Node1/Node2/Node3', $path_at_root->toString());
60 $this->assertEquals(
'//Node2/Node3', $sub_path->toString());
61 $this->assertEquals(
'//Node1/Node2', $sub_path2->toString());