31 foreach ($this->testNodesToDelete as $node) {
32 if (\
TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($node, PATH_site .
'typo3temp/')) {
43 public function constructorThrowsExceptionIfParentIsNotNull() {
45 $node = $this->
getAccessibleMock(
'TYPO3\\CMS\\Install\\FolderStructure\\RootNode', array(
'isWindowsOs'), array(),
'', FALSE);
46 $falseParent = $this->getMock(
47 'TYPO3\CMS\Install\FolderStructure\RootNodeInterface',
53 $node->__construct(array(), $falseParent);
60 public function constructorThrowsExceptionIfAbsolutePathIsNotSet() {
62 $node = $this->
getAccessibleMock(
'TYPO3\\CMS\\Install\\FolderStructure\\RootNode', array(
'isWindowsOs'), array(),
'', FALSE);
66 $node->__construct($structure, NULL);
73 public function constructorThrowsExceptionIfAbsolutePathIsNotAbsoluteOnWindows() {
75 $node = $this->
getAccessibleMock(
'TYPO3\\CMS\\Install\\FolderStructure\\RootNode', array(
'isWindowsOs'), array(),
'', FALSE);
77 ->expects($this->any())
78 ->method(
'isWindowsOs')
79 ->will($this->returnValue(TRUE));
83 $node->__construct($structure, NULL);
90 public function constructorThrowsExceptionIfAbsolutePathIsNotAbsoluteOnUnix() {
92 $node = $this->
getAccessibleMock(
'TYPO3\\CMS\\Install\\FolderStructure\\RootNode', array(
'isWindowsOs'), array(),
'', FALSE);
94 ->expects($this->any())
95 ->method(
'isWindowsOs')
96 ->will($this->returnValue(FALSE));
100 $node->__construct($structure, NULL);
106 public function constructorSetsParentToNull() {
108 $node = $this->
getAccessibleMock(
'TYPO3\\CMS\\Install\\FolderStructure\\RootNode', array(
'isWindowsOs'), array(),
'', FALSE);
110 ->expects($this->any())
111 ->method(
'isWindowsOs')
112 ->will($this->returnValue(FALSE));
116 $node->__construct($structure, NULL);
117 $this->assertNull($node->_call(
'getParent'));
123 public function getChildrenReturnsChildCreatedByConstructor() {
125 $node = $this->
getAccessibleMock(
'TYPO3\\CMS\\Install\\FolderStructure\\RootNode', array(
'isWindowsOs'), array(),
'', FALSE);
127 ->expects($this->any())
128 ->method(
'isWindowsOs')
129 ->will($this->returnValue(FALSE));
135 'type' =>
'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
136 'name' => $childName,
140 $node->__construct($structure, NULL);
141 $children = $node->_call(
'getChildren');
143 $child = $children[0];
144 $this->assertInstanceOf(
'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode', $child);
145 $this->assertSame($childName, $child->getName());
151 public function constructorSetsTargetPermission() {
153 $node = $this->
getAccessibleMock(
'TYPO3\\CMS\\Install\\FolderStructure\\RootNode', array(
'isWindowsOs'), array(),
'', FALSE);
155 ->expects($this->any())
156 ->method(
'isWindowsOs')
157 ->will($this->returnValue(FALSE));
158 $targetPermission =
'2550';
161 'targetPermission' => $targetPermission,
163 $node->__construct($structure, NULL);
164 $this->assertSame($targetPermission, $node->_call(
'getTargetPermission'));
170 public function constructorSetsName() {
172 $node = $this->
getAccessibleMock(
'TYPO3\\CMS\\Install\\FolderStructure\\RootNode', array(
'isWindowsOs'), array(),
'', FALSE);
174 ->expects($this->any())
175 ->method(
'isWindowsOs')
176 ->will($this->returnValue(FALSE));
178 $node->__construct(array(
'name' => $name), NULL);
179 $this->assertSame($name, $node->getName());
185 public function getStatusReturnsArrayWithOkStatusAndCallsOwnStatusMethods() {
188 'TYPO3\\CMS\\Install\\FolderStructure\\RootNode',
189 array(
'getAbsolutePath',
'exists',
'isDirectory',
'isWritable',
'isPermissionCorrect'),
194 $path = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'dir_');
196 $this->testNodesToDelete[] = $path;
197 $node->expects($this->any())->method(
'getAbsolutePath')->will($this->returnValue($path));
198 $node->expects($this->once())->method(
'exists')->will($this->returnValue(TRUE));
199 $node->expects($this->once())->method(
'isDirectory')->will($this->returnValue(TRUE));
200 $node->expects($this->once())->method(
'isPermissionCorrect')->will($this->returnValue(TRUE));
201 $node->expects($this->once())->method(
'isWritable')->will($this->returnValue(TRUE));
202 $statusArray = $node->getStatus();
204 $status = $statusArray[0];
205 $this->assertInstanceOf(
'\TYPO3\CMS\Install\Status\OkStatus', $status);
211 public function getStatusCallsGetChildrenStatusForStatus() {
214 'TYPO3\\CMS\\Install\\FolderStructure\\RootNode',
215 array(
'getAbsolutePath',
'exists',
'isDirectory',
'isWritable',
'isPermissionCorrect',
'getChildrenStatus'),
220 $path = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'dir_');
222 $this->testNodesToDelete[] = $path;
223 $node->expects($this->any())->method(
'getAbsolutePath')->will($this->returnValue($path));
224 $node->expects($this->any())->method(
'exists')->will($this->returnValue(TRUE));
225 $node->expects($this->any())->method(
'isDirectory')->will($this->returnValue(TRUE));
226 $node->expects($this->any())->method(
'isPermissionCorrect')->will($this->returnValue(TRUE));
227 $node->expects($this->any())->method(
'isWritable')->will($this->returnValue(TRUE));
228 $childStatusMock = $this->getMock(
'TYPO3\\CMS\\Install\\Status\\ErrorStatus', array(), array(),
'', FALSE);
229 $node->expects($this->once())->method(
'getChildrenStatus')->will($this->returnValue(array($childStatusMock)));
230 $statusArray = $node->getStatus();
232 $statusSelf = $statusArray[0];
233 $statusOfChild = $statusArray[1];
234 $this->assertInstanceOf(
'\TYPO3\CMS\Install\Status\OkStatus', $statusSelf);
235 $this->assertInstanceOf(
'\TYPO3\CMS\Install\Status\ErrorStatus', $statusOfChild);
241 public function getAbsolutePathReturnsGivenName() {
243 $node = $this->
getAccessibleMock(
'TYPO3\\CMS\\Install\\FolderStructure\\RootNode', array(
'isWindowsOs'), array(),
'', FALSE);
245 ->expects($this->any())
246 ->method(
'isWindowsOs')
247 ->will($this->returnValue(FALSE));
252 $node->__construct($structure, NULL);
253 $this->assertSame($path, $node->getAbsolutePath());
static rmdir($path, $removeNonEmpty=FALSE)
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)