17 use org\bovigo\vfs\vfsStream;
18 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
34 protected function setUp()
37 $this->mountDir = $this->getUniqueId(
'mount-');
38 $this->basedir = $this->getUniqueId(
'base-');
39 vfsStream::setup($this->basedir);
41 $this->vfsContents = [$this->mountDir => []];
56 vfsStream::create($this->vfsContents);
77 return vfsStream::url($this->basedir .
'/' . $this->mountDir .
'/' . ltrim($path,
'/'));
85 protected function addToVfs(array $dirStructure)
96 protected function getUrl($path)
98 return vfsStream::url($this->basedir .
'/' . ltrim($path,
'/'));
111 if (!empty($mockedMethods)) {
112 if (!in_array(
'getIdentifier', $mockedMethods)) {
113 $mockedMethods[] =
'getIdentifier';
115 if (!in_array(
'getName', $mockedMethods)) {
116 $mockedMethods[] =
'getName';
119 $mock = $this->getMockBuilder($type)
120 ->setMethods($mockedMethods)
121 ->disableOriginalConstructor()
123 $mock->expects($this->any())->method(
'getIdentifier')->will($this->returnValue($identifier));
124 $mock->expects($this->any())->method(
'getName')->will($this->returnValue(basename($identifier)));
161 protected function getFolderMock($identifier, $mockedMethods = [], $subfolders = [], $files = [])
163 $folder = $this->
_createFileFolderMock(\
TYPO3\CMS\Core\Resource\Folder::class, $identifier, array_merge($mockedMethods, [
'getFiles',
'getSubfolders']));
164 $folder->expects($this->any())->method(
'getSubfolders')->will($this->returnValue($subfolders));
165 $folder->expects($this->any())->method(
'getFiles')->will($this->returnValue($files));