/** * @test */ public function symlinksCanBeCreated() { $this->markTestSkipped('symlink() is not routed through the stream wrapper as of PHP 5.5, therefore we cannot test it'); /* * symlink() is not routed through the stream wrapper as of PHP 5.5, * therefore we cannot test it. */ vfsStream::setup('root'); FileStreamWrapper::init(PATH_site); FileStreamWrapper::registerOverlayPath('fileadmin', 'vfs://root/fileadmin'); $path = PATH_site . 'fileadmin/'; touch($path . 'file1.txt'); symlink($path . 'file1.txt', $path . 'file2.txt'); $this->assertTrue(is_link($path . 'file2.txt')); FileStreamWrapper::destroy(); }
/** * @test * @dataProvider mkdirDeepCreatesDirectoryWithAndWithoutDoubleSlashesDataProvider */ public function mkdirDeepCreatesDirectoryWithDoubleSlashes($directoryToCreate) { vfsStream::setup(); // Load fixture files and folders from disk FileStreamWrapper::init(PATH_site); FileStreamWrapper::registerOverlayPath('fileadmin', 'vfs://root/fileadmin', true); GeneralUtility::mkdir_deep(PATH_site, $directoryToCreate); $this->assertTrue(is_dir(PATH_site . $directoryToCreate)); FileStreamWrapper::destroy(); }
/** * @test */ public function getFileReturnsCorrectIdentifier() { $root = vfsStream::setup(); $subFolder = vfsStream::newDirectory('fileadmin'); $root->addChild($subFolder); // Load fixture files and folders from disk $directory = vfsStream::copyFromFileSystem(__DIR__ . '/Fixtures/', $subFolder, 1024 * 1024); FileStreamWrapper::init(PATH_site); FileStreamWrapper::registerOverlayPath('fileadmin/', 'vfs://root/fileadmin/', false); $subject = $this->createDriver(array('basePath' => PATH_site . 'fileadmin')); $subdirFileInfo = $subject->getFileInfoByIdentifier('Dummy.html'); $this->assertEquals('/Dummy.html', $subdirFileInfo['identifier']); $rootFileInfo = $subject->getFileInfoByIdentifier('LocalDriverFilenameFilter.php'); $this->assertEquals('/LocalDriverFilenameFilter.php', $rootFileInfo['identifier']); FileStreamWrapper::destroy(); }