本文整理汇总了PHP中TYPO3\CMS\Core\Resource\ResourceStorage::addFile方法的典型用法代码示例。如果您正苦于以下问题:PHP ResourceStorage::addFile方法的具体用法?PHP ResourceStorage::addFile怎么用?PHP ResourceStorage::addFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Resource\ResourceStorage
的用法示例。
在下文中一共展示了ResourceStorage::addFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addFileFailsIfFileDoesNotExist
/**
* @test
*/
public function addFileFailsIfFileDoesNotExist()
{
$mockedFolder = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Folder', array(), array(), '', FALSE);
$this->setExpectedException('InvalidArgumentException', '', 1319552745);
$this->prepareFixture(array());
$this->fixture->addFile('/some/random/file', $mockedFolder);
}
示例2: addFileFailsIfFileDoesNotExist
/**
* @test
*/
public function addFileFailsIfFileDoesNotExist()
{
/** @var Folder|\PHPUnit_Framework_MockObject_MockObject $mockedFolder */
$mockedFolder = $this->getMock(Folder::class, array(), array(), '', false);
$this->setExpectedException('InvalidArgumentException', '', 1319552745);
$this->prepareSubject(array());
$this->subject->addFile('/some/random/file', $mockedFolder);
}
示例3: addFileChangesFilenameIfFileExists
/**
* @test
*/
public function addFileChangesFilenameIfFileExists()
{
$mockedFolder = $this->getSimpleFolderMock('/');
$this->addToMount(array('targetFolder' => array('file.ext' => 'asdf', 'file_01.ext' => 'asjdlkajs'), 'file.ext' => 'ajslkd'));
$this->initializeVfs();
$this->prepareFixture(array());
/** @var $driver \TYPO3\CMS\Core\Resource\Driver\LocalDriver */
$driver = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Driver\\LocalDriver', array('addFile', 'fileExistsInFolder'), array(array('basePath' => $this->getUrlInMount('targetFolder/'))));
$driver->expects($this->once())->method('addFile')->with($this->anything(), $this->anything(), $this->equalTo('file_02.ext'));
$driver->expects($this->exactly(3))->method('fileExistsInFolder')->will($this->onConsecutiveCalls($this->returnValue(TRUE), $this->returnValue(TRUE), $this->returnValue(FALSE)));
$this->fixture->setDriver($driver);
$this->fixture->addFile($this->getUrlInMount('file.ext'), $mockedFolder);
}
示例4: addFile
/**
* Adds a file from the local server disk. If the file already exists and
* overwriting is disabled,
*
* @param string $localFilePath
* @param string $fileName
* @param string $conflictMode possible value are 'cancel', 'replace', 'changeName'
* @return File The file object
*/
public function addFile($localFilePath, $fileName = NULL, $conflictMode = 'cancel') {
$fileName = $fileName ? $fileName : PathUtility::basename($localFilePath);
return $this->storage->addFile($localFilePath, $this, $fileName, $conflictMode);
}
示例5: addFile
/**
* Adds a file from the local server disk. If the file already exists and
* overwriting is disabled,
*
* @param string $localFilePath
* @param string $fileName
* @param string $conflictMode a value of the \TYPO3\CMS\Core\Resource\DuplicationBehavior enumeration
* @return File The file object
*/
public function addFile($localFilePath, $fileName = null, $conflictMode = DuplicationBehavior::CANCEL)
{
$fileName = $fileName ? $fileName : PathUtility::basename($localFilePath);
return $this->storage->addFile($localFilePath, $this, $fileName, $conflictMode);
}