Revert "[BUGFIX] Do not append a "/" to the folder identifier" 76/47776/3
authorFrans Saris <franssaris@gmail.com>
Tue, 19 Apr 2016 09:42:38 +0000 (11:42 +0200)
committerFrans Saris <franssaris@gmail.com>
Tue, 19 Apr 2016 16:46:57 +0000 (18:46 +0200)
This introduced a breaking chance in API and cannot be backported.

Reverts: #66861
Releases: 7.6

This reverts commit 1692e251aa61becb80897fd571bcf644296891ac.

Change-Id: Ic28c5e7942d61dcaea73b688087897374c070bb0
Reviewed-on: https://review.typo3.org/47776
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
typo3/sysext/core/Classes/Resource/Folder.php
typo3/sysext/core/Tests/Unit/Resource/FolderTest.php
typo3/sysext/core/Tests/Unit/Resource/ResourceFactoryTest.php

index 772a01e..a1a7b89 100644 (file)
@@ -81,7 +81,7 @@ class Folder implements FolderInterface
     public function __construct(ResourceStorage $storage, $identifier, $name)
     {
         $this->storage = $storage;
-        $this->identifier = $identifier;
+        $this->identifier = rtrim($identifier, '/') . '/';
         $this->name = $name;
     }
 
index 321d7e6..0a84a7f 100644 (file)
@@ -140,33 +140,6 @@ class FolderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      */
-    public function getSubfolderCallsFactoryWithCorrectArguments()
-    {
-        $mockedStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
-        $mockedStorage->expects($this->once())->method('hasFolderInFolder')->with($this->equalTo('someSubfolder'))->will($this->returnValue(true));
-        /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Resource\ResourceFactory $mockedFactory */
-        $mockedFactory = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceFactory::class);
-        $folderFixture = $this->createFolderFixture(
-            '/somePath/someFolder/',
-            'someFolder',
-            $mockedStorage
-        );
-        $subfolderFixture = $this->createFolderFixture(
-            '/somePath/someSubfolder/',
-            'someSubfolder',
-            $mockedStorage
-        );
-        $mockedStorage->expects($this->once())->method('getFolderInFolder')->will($this->returnValue($subfolderFixture));
-        \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(
-            \TYPO3\CMS\Core\Resource\ResourceFactory::class,
-            $mockedFactory
-        );
-        $this->assertEquals($subfolderFixture, $folderFixture->getSubfolder('someSubfolder'));
-    }
-
-    /**
-     * @test
-     */
     public function getParentFolderGetsParentFolderFromStorage()
     {
         $parentIdentifier = '/parent/';
index 21b068c..bfd108c 100644 (file)
@@ -62,7 +62,7 @@ class ResourceFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $name = $this->getUniqueId();
         $storageCollection = $this->subject->createFolderObject($mockedMount, $path, $name, 0);
         $this->assertSame($mockedMount, $storageCollection->getStorage());
-        $this->assertEquals($path, $storageCollection->getIdentifier());
+        $this->assertEquals($path . '/', $storageCollection->getIdentifier());
         $this->assertEquals($name, $storageCollection->getName());
     }