[BUGFIX] Correct trim of trailing slash 39/36339/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Wed, 28 Jan 2015 21:25:35 +0000 (22:25 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 29 Jan 2015 12:39:49 +0000 (13:39 +0100)
The trailing slash was accidentally trimmed of $expectedTarget, which
never has a trailing slash. Remove the slash from $actualTarget now.

Resolves: #57413
Releases: master, 6.2
Change-Id: Idf05dd7c8cbe808b0c8ae8734db206b934280e97
Reviewed-on: http://review.typo3.org/36339
Reviewed-by: Mateusz Wojtuła <matw88@gmail.com>
Tested-by: Mateusz Wojtuła <matw88@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/install/Classes/FolderStructure/LinkNode.php
typo3/sysext/install/Tests/Unit/FolderStructure/LinkNodeTest.php

index 0a87c12..b2b5fe6 100644 (file)
@@ -180,7 +180,7 @@ class LinkNode extends AbstractNode implements NodeInterface {
                        $result = TRUE;
                } else {
                        $actualTarget = $this->getCurrentTarget();
-                       if ($actualTarget === rtrim($expectedTarget, '/')) {
+                       if ($expectedTarget === rtrim($actualTarget, '/')) {
                                $result = TRUE;
                        }
                }
index 5d05d1b..1ccc665 100644 (file)
@@ -312,8 +312,8 @@ class LinkNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $node = $this->getAccessibleMock(\TYPO3\CMS\Install\FolderStructure\LinkNode::class, array('exists', 'isLink', 'getCurrentTarget', 'getTarget'), array(), '', FALSE);
                $node->expects($this->any())->method('exists')->will($this->returnValue(TRUE));
                $node->expects($this->any())->method('isLink')->will($this->returnValue(TRUE));
-               $node->expects($this->once())->method('getCurrentTarget')->will($this->returnValue('someLinkTarget'));
-               $node->expects($this->once())->method('getTarget')->will($this->returnValue('someLinkTarget/'));
+               $node->expects($this->once())->method('getCurrentTarget')->will($this->returnValue('someLinkTarget/'));
+               $node->expects($this->once())->method('getTarget')->will($this->returnValue('someLinkTarget'));
                $this->assertTrue($node->_call('isTargetCorrect'));
        }