當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ResourceStorage::addFile方法代碼示例

本文整理匯總了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);
 }
開發者ID:samuweiss,項目名稱:TYPO3-Site,代碼行數:10,代碼來源:ResourceStorageTest.php

示例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);
 }
開發者ID:rickymathew,項目名稱:TYPO3.CMS,代碼行數:11,代碼來源:ResourceStorageTest.php

示例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);
 }
開發者ID:nicksergio,項目名稱:TYPO3v4-Core,代碼行數:16,代碼來源:ResourceStorageTest.php

示例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);
	}
開發者ID:,項目名稱:,代碼行數:13,代碼來源:

示例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);
 }
開發者ID:TYPO3Incubator,項目名稱:TYPO3.CMS,代碼行數:14,代碼來源:Folder.php


注:本文中的TYPO3\CMS\Core\Resource\ResourceStorage::addFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。