[TASK] ext:install Protect some methods in FolderStructure 23/24123/4
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 28 Sep 2013 12:55:07 +0000 (14:55 +0200)
committerSusanne Moog <typo3@susannemoog.de>
Sat, 28 Sep 2013 14:27:12 +0000 (16:27 +0200)
Some methods within FolderStructure class hierachy are public
but should be used internally only. The patch protects them.

Change-Id: I273f829f29ca4f5a6da1d03f028be7a8500e222b
Resolves: #52354
Releases: 6.2
Reviewed-on: https://review.typo3.org/24123
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
typo3/sysext/install/Classes/FolderStructure/AbstractNode.php
typo3/sysext/install/Classes/FolderStructure/NodeInterface.php
typo3/sysext/install/Tests/Unit/FolderStructure/AbstractNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/DirectoryNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/FileNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/RootNodeTest.php

index 8765166..d50920e 100644 (file)
@@ -65,7 +65,7 @@ abstract class AbstractNode {
         *
         * @return string Permission, eg. 2770
         */
-       public function getTargetPermission() {
+       protected function getTargetPermission() {
                return $this->targetPermission;
        }
 
@@ -74,7 +74,7 @@ abstract class AbstractNode {
         *
         * @return array
         */
-       public function getChildren() {
+       protected function getChildren() {
                return $this->children;
        }
 
@@ -83,7 +83,7 @@ abstract class AbstractNode {
         *
         * @return NULL|NodeInterface
         */
-       public function getParent() {
+       protected function getParent() {
                return $this->parent;
        }
 
@@ -93,7 +93,7 @@ abstract class AbstractNode {
         * @return string
         */
        public function getAbsolutePath() {
-               return $this->parent->getAbsolutePath() . '/' . $this->name;
+               return $this->getParent()->getAbsolutePath() . '/' . $this->name;
        }
 
        /**
@@ -102,7 +102,7 @@ abstract class AbstractNode {
         * @return boolean TRUE if parent is writable
         */
        public function isWritable() {
-               return $this->parent->isWritable();
+               return $this->getParent()->isWritable();
        }
 
        /**
@@ -133,7 +133,7 @@ abstract class AbstractNode {
                                1366744035
                        );
                }
-               $result = @chmod($this->getAbsolutePath(), octdec($this->targetPermission));
+               $result = @chmod($this->getAbsolutePath(), octdec($this->getTargetPermission()));
                if ($result === TRUE) {
                        $status = new Status\OkStatus();
                        $status->setTitle('Fixed permission on ' . $this->getRelativePathBelowSiteRoot() . '.');
@@ -157,7 +157,7 @@ abstract class AbstractNode {
                if ($this->isWindowsOs()) {
                        return TRUE;
                }
-               if ($this->getCurrentPermission() === $this->targetPermission) {
+               if ($this->getCurrentPermission() === $this->getTargetPermission()) {
                        return TRUE;
                } else {
                        return FALSE;
index 3c6bcfc..72ef688 100644 (file)
@@ -44,20 +44,6 @@ interface NodeInterface {
         */
        public function getName();
 
-       /**
-        * Get target permission
-        *
-        * @return string Permission, eg. 2770
-        */
-       public function getTargetPermission();
-
-       /**
-        * Return children - root and directory, link and file always return empty array
-        *
-        * @return array Children
-        */
-       public function getChildren();
-
        /**
         * Get absolute path of node
         *
index 2e8f99b..b2e7c74 100644 (file)
@@ -67,7 +67,7 @@ class AbstractNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $node = $this->getAccessibleMock('TYPO3\\CMS\\Install\\FolderStructure\\AbstractNode', array('dummy'), array(), '', FALSE);
                $permission = '1234';
                $node->_set('targetPermission', $permission);
-               $this->assertSame($permission, $node->getTargetPermission());
+               $this->assertSame($permission, $node->_call('getTargetPermission'));
        }
 
        /**
@@ -78,7 +78,7 @@ class AbstractNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $node = $this->getAccessibleMock('TYPO3\\CMS\\Install\\FolderStructure\\AbstractNode', array('dummy'), array(), '', FALSE);
                $children = array('1234');
                $node->_set('children', $children);
-               $this->assertSame($children, $node->getChildren());
+               $this->assertSame($children, $node->_call('getChildren'));
        }
 
        /**
@@ -89,7 +89,7 @@ class AbstractNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $node = $this->getAccessibleMock('TYPO3\\CMS\\Install\\FolderStructure\\AbstractNode', array('dummy'), array(), '', FALSE);
                $parent = $this->getMock('TYPO3\CMS\Install\FolderStructure\RootNodeInterface', array(), array(), '', FALSE);
                $node->_set('parent', $parent);
-               $this->assertSame($parent, $node->getParent());
+               $this->assertSame($parent, $node->_call('getParent'));
        }
 
        /**
@@ -368,3 +368,4 @@ class AbstractNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->assertSame('/foo/bar', $result);
        }
 }
+?>
\ No newline at end of file
index 5582554..bc5ac0d 100644 (file)
@@ -104,7 +104,7 @@ class DirectoryNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        'name' => 'foo',
                );
                $node->__construct($structure, $parent);
-               $this->assertSame($parent, $node->getParent());
+               $this->assertSame($parent, $node->_call('getParent'));
        }
 
        /**
@@ -120,7 +120,7 @@ class DirectoryNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        'targetPermission' => $targetPermission,
                );
                $node->__construct($structure, $parent);
-               $this->assertSame($targetPermission, $node->getTargetPermission());
+               $this->assertSame($targetPermission, $node->_call('getTargetPermission'));
        }
 
        /**
@@ -577,7 +577,7 @@ class DirectoryNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ),
                );
                $node->__construct($structure, $parent);
-               $children = $node->getChildren();
+               $children = $node->_call('getChildren');
                /** @var $child \TYPO3\CMS\Install\FolderStructure\NodeInterface */
                $child = $children[0];
                $this->assertInstanceOf('TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode', $children[0]);
@@ -661,3 +661,4 @@ class DirectoryNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->assertFalse($node->_call('isDirectory'));
        }
 }
+?>
\ No newline at end of file
index 703ac35..0aea19f 100644 (file)
@@ -80,7 +80,7 @@ class FileNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        'name' => 'foo',
                );
                $node->__construct($structure, $parent);
-               $this->assertSame($parent, $node->getParent());
+               $this->assertSame($parent, $node->_call('getParent'));
        }
 
        /**
@@ -96,7 +96,7 @@ class FileNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        'targetPermission' => $targetPermission,
                );
                $node->__construct($structure, $parent);
-               $this->assertSame($targetPermission, $node->getTargetPermission());
+               $this->assertSame($targetPermission, $node->_call('getTargetPermission'));
        }
 
        /**
index b12da46..1a866d2 100644 (file)
@@ -123,7 +123,7 @@ class RootNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        'name' => '/bar'
                );
                $node->__construct($structure, NULL);
-               $this->assertNull($node->getParent());
+               $this->assertNull($node->_call('getParent'));
        }
 
        /**
@@ -147,7 +147,7 @@ class RootNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ),
                );
                $node->__construct($structure, NULL);
-               $children = $node->getChildren();
+               $children = $node->_call('getChildren');
                /** @var $child \TYPO3\CMS\install\FolderStructure\NodeInterface */
                $child = $children[0];
                $this->assertInstanceOf('TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode', $child);
@@ -170,7 +170,7 @@ class RootNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        'targetPermission' => $targetPermission,
                );
                $node->__construct($structure, NULL);
-               $this->assertSame($targetPermission, $node->getTargetPermission());
+               $this->assertSame($targetPermission, $node->_call('getTargetPermission'));
        }
 
        /**
@@ -262,3 +262,4 @@ class RootNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->assertSame($path, $node->getAbsolutePath());
        }
 }
+?>
\ No newline at end of file