17 use \org\bovigo\vfs\vfsStream;
35 vfsStream::setup($this->basedir);
44 if ($mockedStorage === NULL) {
45 $mockedStorage = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(),
'', FALSE);
47 return new \TYPO3\CMS\Core\Resource\Folder($mockedStorage, $path, $name, 0);
56 $mockedStorage = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(),
'', FALSE);
58 $this->assertSame($mockedStorage, $fixture->getStorage());
59 $this->assertStringStartsWith($path, $fixture->getIdentifier());
60 $this->assertSame($name, $fixture->getName());
68 $fixture->updateProperties(array(
'identifier' =>
'/someOtherPath',
'name' =>
'someNewName'));
69 $this->assertSame(
'someNewName', $fixture->getName());
70 $this->assertSame(
'/someOtherPath', $fixture->getIdentifier());
78 $fixture->updateProperties(array(
'identifier' =>
'/someOtherPath'));
79 $this->assertSame(
'someName', $fixture->getName());
86 $mockedStorage = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(),
'', FALSE);
87 $mockedStorage->expects($this->once())->method(
'getFilesInFolder')->will($this->returnValue(array(
88 'somefile.png' => array(
89 'name' =>
'somefile.png' 91 'somefile.jpg' => array(
92 'name' =>
'somefile.jpg' 98 $fileList = $fixture->getFiles();
100 $this->assertSame(array(
'somefile.png',
'somefile.jpg'), array_keys($fileList));
107 $mockedStorage = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(),
'', FALSE);
109 ->expects($this->once())
110 ->method(
'getFilesInFolder')
111 ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), FALSE)
112 ->will($this->returnValue(array()));
115 $fixture->getFiles();
122 $mockedStorage = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(),
'', FALSE);
124 ->expects($this->once())
125 ->method(
'getFilesInFolder')
126 ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), TRUE)
127 ->will($this->returnValue(array()));
137 $mockedStorage = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(),
'', FALSE);
138 $mockedStorage->expects($this->once())->method(
'hasFolderInFolder')->with($this->equalTo(
'someSubfolder'))->will($this->returnValue(TRUE));
139 $mockedFactory = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceFactory');
140 $mockedFactory->expects($this->once())->method(
'createFolderObject')->with($mockedStorage,
'/somePath/someFolder/someSubfolder/',
'someSubfolder');
142 $fixture = $this->
createFolderFixture(
'/somePath/someFolder/',
'someFolder', $mockedStorage);
143 $fixture->getSubfolder(
'someSubfolder');
150 $parentIdentifier =
'/parent/';
151 $currentIdentifier =
'/parent/current/';
154 $mockedStorage = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(
'getFolderIdentifierFromFileIdentifier',
'getFolder'), array(),
'', FALSE);
155 $mockedStorage->expects($this->once())->method(
'getFolderIdentifierFromFileIdentifier')->with($currentIdentifier)->will($this->returnValue($parentIdentifier));
156 $mockedStorage->expects($this->once())->method(
'getFolder')->with($parentIdentifier)->will($this->returnValue($parentFolderFixture));
158 $currentFolderFixture = $this->
createFolderFixture($currentIdentifier,
'current', $mockedStorage);
160 $this->assertSame($parentFolderFixture, $currentFolderFixture->getParentFolder());
static getSingletonInstances()
getParentFolderGetsParentFolderFromStorage()
static setSingletonInstance($className, \TYPO3\CMS\Core\SingletonInterface $instance)
getFilesHandsOverRecursiveTRUEifSet()
getSubfolderCallsFactoryWithCorrectArguments()
constructorArgumentsAreAvailableAtRuntime()
static resetSingletonInstances(array $newSingletonInstances)
getFilesReturnsArrayWithFilenamesAsKeys()
getFilesHandsOverRecursiveFALSEifNotExplicitlySet()
const FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS
createFolderFixture($path, $name, $mockedStorage=NULL)
propertiesAreNotUpdatedIfNotSetInInput()