23 use TYPO3\TestingFramework\Core\AccessibleObjectInterface;
24 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
36 $this->expectException(RootNodeException::class);
37 $this->expectExceptionCode(1366140117);
39 $node = $this->getAccessibleMock(RootNode::class, [
'isWindowsOs'], [],
'',
false);
40 $falseParent = $this->createMock(\
TYPO3\CMS\Install\FolderStructure\RootNodeInterface::class);
41 $node->__construct([], $falseParent);
49 $this->expectException(InvalidArgumentException::class);
50 $this->expectExceptionCode(1366141329);
52 $node = $this->getAccessibleMock(RootNode::class, [
'isWindowsOs'], [],
'',
false);
56 $node->__construct($structure,
null);
64 $this->expectException(InvalidArgumentException::class);
65 $this->expectExceptionCode(1366141329);
67 $node = $this->getAccessibleMock(RootNode::class, [
'isWindowsOs'], [],
'',
false);
69 ->expects($this->any())
70 ->method(
'isWindowsOs')
71 ->will($this->returnValue(
true));
75 $node->__construct($structure,
null);
83 $this->expectException(InvalidArgumentException::class);
84 $this->expectExceptionCode(1366141329);
86 $node = $this->getAccessibleMock(RootNode::class, [
'isWindowsOs'], [],
'',
false);
88 ->expects($this->any())
89 ->method(
'isWindowsOs')
90 ->will($this->returnValue(
false));
94 $node->__construct($structure,
null);
103 $node = $this->getAccessibleMock(RootNode::class, [
'isWindowsOs'], [],
'',
false);
105 ->expects($this->any())
106 ->method(
'isWindowsOs')
107 ->will($this->returnValue(
false));
111 $node->__construct($structure,
null);
112 $this->assertNull($node->_call(
'getParent'));
121 $node = $this->getAccessibleMock(RootNode::class, [
'isWindowsOs'], [],
'',
false);
123 ->expects($this->any())
124 ->method(
'isWindowsOs')
125 ->will($this->returnValue(
false));
126 $childName = $this->getUniqueId(
'test_');
131 'type' => DirectoryNode::class,
132 'name' => $childName,
136 $node->__construct($structure,
null);
137 $children = $node->_call(
'getChildren');
139 $child = $children[0];
140 $this->assertInstanceOf(DirectoryNode::class, $child);
141 $this->assertSame($childName, $child->getName());
150 $node = $this->getAccessibleMock(RootNode::class, [
'isWindowsOs'], [],
'',
false);
152 ->expects($this->any())
153 ->method(
'isWindowsOs')
154 ->will($this->returnValue(
false));
155 $targetPermission =
'2550';
158 'targetPermission' => $targetPermission,
160 $node->__construct($structure,
null);
161 $this->assertSame($targetPermission, $node->_call(
'getTargetPermission'));
170 $node = $this->getAccessibleMock(RootNode::class, [
'isWindowsOs'], [],
'',
false);
172 ->expects($this->any())
173 ->method(
'isWindowsOs')
174 ->will($this->returnValue(
false));
175 $name =
'/' . $this->getUniqueId(
'test_');
176 $node->__construct([
'name' => $name],
null);
177 $this->assertSame($name, $node->getName());
186 $node = $this->getAccessibleMock(
188 [
'getAbsolutePath',
'exists',
'isDirectory',
'isWritable',
'isPermissionCorrect'],
195 $this->testFilesToDelete[] = $path;
196 $node->expects($this->any())->method(
'getAbsolutePath')->will($this->returnValue($path));
197 $node->expects($this->once())->method(
'exists')->will($this->returnValue(
true));
198 $node->expects($this->once())->method(
'isDirectory')->will($this->returnValue(
true));
199 $node->expects($this->once())->method(
'isPermissionCorrect')->will($this->returnValue(
true));
200 $node->expects($this->once())->method(
'isWritable')->will($this->returnValue(
true));
201 $statusArray = $node->getStatus();
211 $node = $this->getAccessibleMock(
213 [
'getAbsolutePath',
'exists',
'isDirectory',
'isWritable',
'isPermissionCorrect',
'getChildrenStatus'],
220 $this->testFilesToDelete[] = $path;
221 $node->expects($this->any())->method(
'getAbsolutePath')->will($this->returnValue($path));
222 $node->expects($this->any())->method(
'exists')->will($this->returnValue(
true));
223 $node->expects($this->any())->method(
'isDirectory')->will($this->returnValue(
true));
224 $node->expects($this->any())->method(
'isPermissionCorrect')->will($this->returnValue(
true));
225 $node->expects($this->any())->method(
'isWritable')->will($this->returnValue(
true));
227 $node->expects($this->once())->method(
'getChildrenStatus')->will($this->returnValue([$childStatus]));
228 $statusArray = $node->getStatus();
229 $statusSelf = $statusArray[0];
230 $statusOfChild = $statusArray[1];
232 $this->assertSame($childStatus, $statusOfChild);
241 $node = $this->getAccessibleMock(RootNode::class, [
'isWindowsOs'], [],
'',
false);
243 ->expects($this->any())
244 ->method(
'isWindowsOs')
245 ->will($this->returnValue(
false));
250 $node->__construct($structure,
null);
251 $this->assertSame($path, $node->getAbsolutePath());