当前位置: 首页>>代码示例>>PHP>>正文


PHP ResourceStorage::expects方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Resource\ResourceStorage::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP ResourceStorage::expects方法的具体用法?PHP ResourceStorage::expects怎么用?PHP ResourceStorage::expects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Resource\ResourceStorage的用法示例。


在下文中一共展示了ResourceStorage::expects方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     $this->singletonInstances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances();
     $this->storageMock = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
     $this->storageMock->expects($this->any())->method('getUid')->will($this->returnValue(5));
     $mockedMetaDataRepository = $this->getMock(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class);
     $mockedMetaDataRepository->expects($this->any())->method('findByFile')->will($this->returnValue(array('file' => 1)));
     \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class, $mockedMetaDataRepository);
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:9,代码来源:FileTest.php

示例2: setUp

 public function setUp()
 {
     $this->singletonInstances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances();
     $this->storageMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(), '', FALSE);
     $this->storageMock->expects($this->any())->method('getUid')->will($this->returnValue(5));
     $mockedMetaDataRepository = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Index\\MetaDataRepository');
     $mockedMetaDataRepository->expects($this->any())->method('findByFile')->will($this->returnValue(array('file' => 1)));
     \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Resource\\Index\\MetaDataRepository', $mockedMetaDataRepository);
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:9,代码来源:FileTest.php

示例3: setUp

 /**
  * Set up
  *
  * @return void
  */
 public function setUp()
 {
     $this->singletonInstances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances();
     $this->fileCollectionMock = $this->getAccessibleMock('\\TYPO3\\CMS\\Core\\Resource\\Collection\\AbstractFileCollection', array('loadContents', 'getItems'), array(), '', FALSE);
     $this->fileCollectionMock->expects($this->atLeastOnce())->method('loadContents');
     $this->fileCollectionRepositoryMock = $this->getMock('\\TYPO3\\CMS\\Core\\Resource\\FileCollectionRepository', array('findByUid'), array(), '', FALSE);
     $this->fileCollectionRepositoryMock->expects($this->any())->method('findByUid')->will($this->returnValue($this->fileCollectionMock));
     $this->frontendConfigurationManagerMock = $this->getMock('\\TYPO3\\CMS\\Extbase\\Configuration\\FrontendConfigurationManager', array('getConfiguration'), array(), '', FALSE);
     $this->storageMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(), '', FALSE);
     $this->storageMock->expects($this->any())->method('getUid')->will($this->returnValue(5));
     $this->subject = GeneralUtility::makeInstance('SKYFILLERS\\SfFilecollectionGallery\\Service\\FileCollectionService');
     $this->subject->injectFileCollectionRepository($this->fileCollectionRepositoryMock);
     $this->subject->injectFrontendConfigurationManager($this->frontendConfigurationManagerMock);
 }
开发者ID:rabe69,项目名称:sf_filecollection_gallery,代码行数:19,代码来源:FileCollectionServiceTest.php

示例4: setUp

 public function setUp()
 {
     $this->singletonInstances = GeneralUtility::getSingletonInstances();
     // Disable xml2array cache used by ResourceFactory
     GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->setCacheConfigurations(array('cache_hash' => array('frontend' => 'TYPO3\\CMS\\Core\\Cache\\Frontend\\VariableFrontend', 'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\TransientMemoryBackend')));
     $this->testDocumentsPath = ExtensionManagementUtility::extPath('tika') . 'Tests/TestDocuments/';
     $driver = $this->createDriverFixture(array('basePath' => $this->testDocumentsPath, 'caseSensitive' => TRUE));
     $storageRecord = array('uid' => $this->storageUid, 'is_public' => TRUE, 'is_writable' => FALSE, 'is_browsable' => TRUE, 'is_online' => TRUE, 'configuration' => $this->convertConfigurationArrayToFlexformXml(array('basePath' => $this->testDocumentsPath, 'pathType' => 'absolute', 'caseSensitive' => '1')));
     $this->storageMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', NULL, array($driver, $storageRecord));
     $this->storageMock->expects($this->any())->method('getUid')->will($this->returnValue($this->storageUid));
     $mockedMetaDataRepository = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Index\\MetaDataRepository');
     $mockedMetaDataRepository->expects($this->any())->method('findByFile')->will($this->returnValue(array('file' => 1)));
     \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Resource\\Index\\MetaDataRepository', $mockedMetaDataRepository);
 }
开发者ID:AndreasA,项目名称:ext-tika,代码行数:14,代码来源:ServerServiceTest.php

示例5: setFileContentsUpdatesObjectProperties

 /**
  * @test
  * @group integration
  * @TODO: Rewrite or move to functional suite
  */
 public function setFileContentsUpdatesObjectProperties()
 {
     $this->markTestSkipped('This test does way to much and is mocked incomplete. Skipped for now.');
     $this->initializeVfs();
     $driverObject = $this->getMockForAbstractClass(AbstractDriver::class, array(), '', false);
     $this->subject = $this->getMock(ResourceStorage::class, array('getFileIndexRepository', 'checkFileActionPermission'), array($driverObject, array()));
     $this->subject->expects($this->any())->method('checkFileActionPermission')->will($this->returnValue(true));
     $fileInfo = array('storage' => 'A', 'identifier' => 'B', 'mtime' => 'C', 'ctime' => 'D', 'mimetype' => 'E', 'size' => 'F', 'name' => 'G');
     $newProperties = array('storage' => $fileInfo['storage'], 'identifier' => $fileInfo['identifier'], 'tstamp' => $fileInfo['mtime'], 'crdate' => $fileInfo['ctime'], 'mime_type' => $fileInfo['mimetype'], 'size' => $fileInfo['size'], 'name' => $fileInfo['name']);
     $hash = 'asdfg';
     /** @var $mockedDriver LocalDriver|\PHPUnit_Framework_MockObject_MockObject */
     $mockedDriver = $this->getMock(LocalDriver::class, array(), array(array('basePath' => $this->getMountRootUrl())));
     $mockedDriver->expects($this->once())->method('getFileInfoByIdentifier')->will($this->returnValue($fileInfo));
     $mockedDriver->expects($this->once())->method('hash')->will($this->returnValue($hash));
     $this->subject->setDriver($mockedDriver);
     $indexFileRepositoryMock = $this->getMock(FileIndexRepository::class);
     $this->subject->expects($this->any())->method('getFileIndexRepository')->will($this->returnValue($indexFileRepositoryMock));
     /** @var $mockedFile File|\PHPUnit_Framework_MockObject_MockObject */
     $mockedFile = $this->getMock(File::class, array(), array(), '', false);
     $mockedFile->expects($this->any())->method('getIdentifier')->will($this->returnValue($fileInfo['identifier']));
     // called by indexer because the properties are updated
     $this->subject->expects($this->any())->method('getFileInfoByIdentifier')->will($this->returnValue($newProperties));
     $mockedFile->expects($this->any())->method('getStorage')->will($this->returnValue($this->subject));
     $mockedFile->expects($this->any())->method('getProperties')->will($this->returnValue(array_keys($fileInfo)));
     $mockedFile->expects($this->any())->method('getUpdatedProperties')->will($this->returnValue(array_keys($newProperties)));
     // do not update directly; that's up to the indexer
     $indexFileRepositoryMock->expects($this->never())->method('update');
     $this->subject->setFileContents($mockedFile, $this->getUniqueId());
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:34,代码来源:ResourceStorageTest.php

示例6: setFileContentsUpdatesObjectProperties

 /**
  * @test
  * @group integration
  * @TODO: Rewrite or move to functional suite
  */
 public function setFileContentsUpdatesObjectProperties()
 {
     $this->markTestSkipped('This test does way to much and is mocked incomplete. Skipped for now.');
     $this->initializeVfs();
     $driverObject = $this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Resource\\Driver\\AbstractDriver', array(), '', FALSE);
     $this->fixture = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array('getFileIndexRepository', 'checkFileActionPermission'), array($driverObject, array()));
     $this->fixture->expects($this->any())->method('checkFileActionPermission')->will($this->returnValue(TRUE));
     $fileInfo = array('storage' => 'A', 'identifier' => 'B', 'mtime' => 'C', 'ctime' => 'D', 'mimetype' => 'E', 'size' => 'F', 'name' => 'G');
     $newProperties = array('storage' => $fileInfo['storage'], 'identifier' => $fileInfo['identifier'], 'tstamp' => $fileInfo['mtime'], 'crdate' => $fileInfo['ctime'], 'mime_type' => $fileInfo['mimetype'], 'size' => $fileInfo['size'], 'name' => $fileInfo['name']);
     $hash = 'asdfg';
     $driver = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Driver\\LocalDriver', array(), array(array('basePath' => $this->getMountRootUrl())));
     $driver->expects($this->once())->method('getFileInfoByIdentifier')->will($this->returnValue($fileInfo));
     $driver->expects($this->once())->method('hash')->will($this->returnValue($hash));
     $this->fixture->setDriver($driver);
     $indexFileRepositoryMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository');
     $this->fixture->expects($this->any())->method('getFileIndexRepository')->will($this->returnValue($indexFileRepositoryMock));
     $mockedFile = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', array(), array(), '', FALSE);
     $mockedFile->expects($this->any())->method('getIdentifier')->will($this->returnValue($fileInfo['identifier']));
     // called by indexer because the properties are updated
     $this->fixture->expects($this->any())->method('getFileInfoByIdentifier')->will($this->returnValue($newProperties));
     $mockedFile->expects($this->any())->method('getStorage')->will($this->returnValue($this->fixture));
     $mockedFile->expects($this->any())->method('getProperties')->will($this->returnValue(array_keys($fileInfo)));
     $mockedFile->expects($this->any())->method('getUpdatedProperties')->will($this->returnValue(array_keys($newProperties)));
     // do not update directly; that's up to the indexer
     $indexFileRepositoryMock->expects($this->never())->method('update');
     $this->fixture->setFileContents($mockedFile, uniqid());
 }
开发者ID:samuweiss,项目名称:TYPO3-Site,代码行数:32,代码来源:ResourceStorageTest.php

示例7: deletingProcessedFileThatUsesOriginalFileDoesNotRemoveFile

 /**
  * @test
  */
 public function deletingProcessedFileThatUsesOriginalFileDoesNotRemoveFile()
 {
     $this->storageMock->expects($this->never())->method('deleteFile');
     $processedDatabaseRow = $this->databaseRow;
     $processedDatabaseRow['identifier'] = NULL;
     $processedFile = $this->getProcessedFileFixture($processedDatabaseRow);
     $processedFile->delete(TRUE);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:11,代码来源:ProcessedFileTest.php

示例8: setUpLanguagesStorageMock

 protected function setUpLanguagesStorageMock()
 {
     $this->testLanguagesPath = ExtensionManagementUtility::extPath('tika') . 'Tests/TestLanguages/';
     $languagesDriver = $this->createDriverFixture(array('basePath' => $this->testLanguagesPath, 'caseSensitive' => TRUE));
     $languagesStorageRecord = array('uid' => $this->languagesStorageUid, 'is_public' => TRUE, 'is_writable' => FALSE, 'is_browsable' => TRUE, 'is_online' => TRUE, 'configuration' => $this->convertConfigurationArrayToFlexformXml(array('basePath' => $this->testLanguagesPath, 'pathType' => 'absolute', 'caseSensitive' => '1')));
     $this->languagesStorageMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', NULL, array($languagesDriver, $languagesStorageRecord));
     $this->languagesStorageMock->expects($this->any())->method('getUid')->will($this->returnValue($this->languagesStorageUid));
 }
开发者ID:visol,项目名称:ext-tika,代码行数:8,代码来源:ServiceUnitTestCase.php

示例9: prepareFixture

 /**
  * Prepare fixture
  *
  * @param array $configuration
  * @param boolean $mockPermissionChecks
  * @return void
  */
 protected function prepareFixture($configuration, $mockPermissionChecks = FALSE, $driverObject = NULL, array $storageRecord = array())
 {
     $permissionMethods = array('isFileActionAllowed', 'isFolderActionAllowed', 'checkFileActionPermission', 'checkUserActionPermission');
     $mockedMethods = NULL;
     $configuration = $this->convertConfigurationArrayToFlexformXml($configuration);
     $storageRecord = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($storageRecord, array('configuration' => $configuration));
     if ($driverObject == NULL) {
         /** @var $mockedDriver \TYPO3\CMS\Core\Resource\Driver\AbstractDriver */
         $driverObject = $this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Resource\\Driver\\AbstractDriver', array(), '', FALSE);
     }
     if ($mockPermissionChecks) {
         $mockedMethods = $permissionMethods;
     }
     if ($mockedMethods === NULL) {
         $this->fixture = new \TYPO3\CMS\Core\Resource\ResourceStorage($driverObject, $storageRecord);
     } else {
         $this->fixture = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', $mockedMethods, array($driverObject, $storageRecord));
         foreach ($permissionMethods as $method) {
             $this->fixture->expects($this->any())->method($method)->will($this->returnValue(TRUE));
         }
     }
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:29,代码来源:ResourceStorageTest.php


注:本文中的TYPO3\CMS\Core\Resource\ResourceStorage::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。