/** * @test */ public function createStorageCollectionObjectCreatesCollectionWithCorrectArguments() { $mockedMount = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false); $path = $this->getUniqueId(); $name = $this->getUniqueId(); $storageCollection = $this->subject->createFolderObject($mockedMount, $path, $name, 0); $this->assertSame($mockedMount, $storageCollection->getStorage()); $this->assertEquals($path . '/', $storageCollection->getIdentifier()); $this->assertEquals($name, $storageCollection->getName()); }
/** * @test */ public function createStorageCollectionObjectCreatesCollectionWithCorrectArguments() { $mockedMount = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(), '', FALSE); $path = uniqid(); $name = uniqid(); $storageCollection = $this->fixture->createFolderObject($mockedMount, $path, $name, 0); $this->assertSame($mockedMount, $storageCollection->getStorage()); $this->assertEquals($path . '/', $storageCollection->getIdentifier()); $this->assertEquals($name, $storageCollection->getName()); }
/** * @param $relFolderPath * @param $pathExists * @return \TYPO3\CMS\Core\Resource\Folder */ protected function createFolderObject($relFolderPath, $pathExists) { if (!$pathExists) { $storage = $this->folderRepository->findByUid(1); return $this->fileFactory->createFolderObject($storage, $relFolderPath, 'upload_folder'); } else { return $this->fileFactory->getFolderObjectFromCombinedIdentifier("1:{$relFolderPath}"); } }