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


PHP ResourceManager::expects方法代码示例

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


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

示例1: openResolvesAnUpperCaseSha1HashUsingTheResourceManager

 /**
  * @test
  */
 public function openResolvesAnUpperCaseSha1HashUsingTheResourceManager()
 {
     $sha1Hash = '68AC906495480A3404BEEE4874ED853A037A7A8F';
     $tempFile = tmpfile();
     $mockResource = $this->getMockBuilder(Resource::class)->disableOriginalConstructor()->getMock();
     $this->mockResourceManager->expects($this->once())->method('getResourceBySha1')->with($sha1Hash)->will($this->returnValue($mockResource));
     $this->mockResourceManager->expects($this->once())->method('getStreamByResource')->with($mockResource)->will($this->returnValue($tempFile));
     $openedPathAndFilename = '';
     $this->assertSame($tempFile, $this->resourceStreamWrapper->open('resource://' . $sha1Hash, 'r', 0, $openedPathAndFilename));
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:13,代码来源:ResourceStreamWrapperTest.php

示例2: openResolvesAnUpperCaseSha1HashUsingTheResourceManager

 /**
  * @test
  */
 public function openResolvesAnUpperCaseSha1HashUsingTheResourceManager()
 {
     $sha1Hash = '68AC906495480A3404BEEE4874ED853A037A7A8F';
     $persistentResourcesStorageBaseUri = 'vfs://Foo/Some/';
     $absoluteResourcePath = $persistentResourcesStorageBaseUri . $sha1Hash;
     mkdir($persistentResourcesStorageBaseUri);
     file_put_contents('vfs://Foo/Some/' . $sha1Hash, 'fixture');
     $this->mockResourceManager->expects($this->once())->method('getPersistentResourcesStorageBaseUri')->will($this->returnValue($persistentResourcesStorageBaseUri));
     $openedPathAndFilename = '';
     $this->assertTrue($this->resourceStreamWrapper->open('resource://' . $sha1Hash, 'r', 0, $openedPathAndFilename));
     $this->assertSame($absoluteResourcePath, $openedPathAndFilename);
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:15,代码来源:ResourceStreamWrapperTest.php

示例3: convertFromReturnsAnErrorIfTheUploadedFileCantBeImported

 /**
  * @test
  */
 public function convertFromReturnsAnErrorIfTheUploadedFileCantBeImported()
 {
     $source = array('tmp_name' => 'SomeFilename', 'error' => \UPLOAD_ERR_OK);
     $this->mockResourceManager->expects($this->once())->method('importUploadedResource')->with($source)->will($this->returnValue(FALSE));
     $actualResult = $this->resourceTypeConverter->convertFrom($source, 'TYPO3\\Flow\\Resource\\Resource');
     $this->assertInstanceOf('TYPO3\\Flow\\Error\\Error', $actualResult);
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:10,代码来源:ResourceTypeConverterTest.php

示例4: convertFromReturnsAnErrorIfTheUploadedFileCantBeImported

 /**
  * @test
  */
 public function convertFromReturnsAnErrorIfTheUploadedFileCantBeImported()
 {
     $this->inject($this->resourceTypeConverter, 'systemLogger', $this->createMock(\TYPO3\Flow\Log\SystemLoggerInterface::class));
     $source = array('tmp_name' => 'SomeFilename', 'error' => \UPLOAD_ERR_OK);
     $this->mockResourceManager->expects($this->once())->method('importUploadedResource')->with($source)->will($this->throwException(new \TYPO3\Flow\Resource\Exception()));
     $actualResult = $this->resourceTypeConverter->convertFrom($source, \TYPO3\Flow\Resource\Resource::class);
     $this->assertInstanceOf(\TYPO3\Flow\Error\Error::class, $actualResult);
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:11,代码来源:ResourceTypeConverterTest.php


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