本文整理汇总了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));
}
示例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);
}
示例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);
}
示例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);
}