41 $this->subject = $this->
getAccessibleMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceFactory', array(
'dummy'), array(),
'', FALSE);
46 foreach ($this->filesCreated as $file) {
59 $mockedMount = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(),
'', FALSE);
62 $storageCollection = $this->subject->createFolderObject($mockedMount, $path, $name, 0);
63 $this->assertSame($mockedMount, $storageCollection->getStorage());
64 $this->assertEquals($path .
'/', $storageCollection->getIdentifier());
65 $this->assertEquals($name, $storageCollection->getName());
75 $mockedDriver = $this->getMockForAbstractClass(
'TYPO3\\CMS\\Core\\Resource\\Driver\\AbstractDriver');
76 $driverFixtureClass = get_class($mockedDriver);
78 $mockedMount = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(),
'', FALSE);
79 $mockedRegistry = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\Driver\\DriverRegistry');
80 $mockedRegistry->expects($this->once())->method(
'getDriverClass')->with($this->equalTo($driverFixtureClass))->will($this->returnValue($driverFixtureClass));
82 $obj = $this->subject->getDriverObject($driverFixtureClass, array());
83 $this->assertInstanceOf(
'TYPO3\\CMS\\Core\\Resource\\Driver\\AbstractDriver', $obj);
93 public function retrieveFileOrFolderObjectCallsGetFolderObjectFromCombinedIdentifierWithRelativePath() {
96 'TYPO3\\CMS\\Core\\Resource\\ResourceFactory',
97 array(
'getFolderObjectFromCombinedIdentifier'),
103 ->expects($this->once())
104 ->method(
'getFolderObjectFromCombinedIdentifier')
106 $subject->retrieveFileOrFolderObject(
'typo3');
112 public function retrieveFileOrFolderObjectCallsGetFolderObjectFromCombinedIdentifierWithAbsolutePath() {
115 'TYPO3\\CMS\\Core\\Resource\\ResourceFactory',
116 array(
'getFolderObjectFromCombinedIdentifier'),
122 ->expects($this->once())
123 ->method(
'getFolderObjectFromCombinedIdentifier')
125 $subject->retrieveFileOrFolderObject(PATH_site .
'typo3');
132 $this->subject = $this->
getAccessibleMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceFactory', array(
'getFileObjectFromCombinedIdentifier'), array(),
'', FALSE);
133 $filename =
'typo3temp/4711.txt';
134 $this->subject->expects($this->once())
135 ->method(
'getFileObjectFromCombinedIdentifier')
139 $this->filesCreated[] = PATH_site . $filename;
140 $this->subject->retrieveFileOrFolderObject($filename);
156 $this->subject->_set(
'localDriverStorageCache', $storageConfiguration);
157 $this->assertSame($expectedStorageId, $this->subject->_callRef(
'findBestMatchingStorageByLocalPath', $path));
167 'NoLocalStoragesReturnDefaultStorage' => array(
169 'my/dummy/Image.png',
172 'NoMatchReturnsDefaultStorage' => array(
173 array(1 =>
'fileadmin/', 2 =>
'fileadmin2/public/'),
174 'my/dummy/Image.png',
177 'MatchReturnsTheMatch' => array(
178 array(1 =>
'fileadmin/', 2 =>
'other/public/'),
179 'fileadmin/dummy/Image.png',
182 'TwoFoldersWithSameStartReturnsCorrect' => array(
183 array(1 =>
'fileadmin/', 2 =>
'fileadmin/public/'),
184 'fileadmin/dummy/Image.png',
187 'NestedStorageReallyReturnsTheBestMatching' => array(
188 array(1 =>
'fileadmin/', 2 =>
'fileadmin/public/'),
189 'fileadmin/public/Image.png',
192 'CommonPrefixButWrongPath' => array(
193 array(1 =>
'fileadmin/', 2 =>
'uploads/test/'),
194 'uploads/bogus/dummy.png',
197 'CommonPrefixRightPath' => array(
198 array(1 =>
'fileadmin/', 2 =>
'uploads/test/'),
199 'uploads/test/dummy.png',
202 'FindStorageFromWindowsPath' => array(
203 array(1 =>
'fileadmin/', 2 =>
'uploads/test/'),
204 'uploads\\test\\dummy.png',
storageDetectionDataProvider()
static getSingletonInstances()
static setSingletonInstance($className, \TYPO3\CMS\Core\SingletonInterface $instance)
static addInstance($className, $instance)
getDriverObjectAcceptsDriverClassName()
static writeFileToTypo3tempDir($filepath, $content)
static resetSingletonInstances(array $newSingletonInstances)
retrieveFileOrFolderObjectReturnsFileIfPathIsGiven()
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
createStorageCollectionObjectCreatesCollectionWithCorrectArguments()
findBestMatchingStorageByLocalPathReturnsDefaultStorageIfNoMatchIsFound(array $storageConfiguration, $path, $expectedStorageId)