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


PHP FileSystem::shouldReceive方法代码示例

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


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

示例1: testGetFile

 public function testGetFile()
 {
     $fs = new SymfonyFileSystem();
     $someJunk = 'whatever dude';
     $hash = md5($someJunk);
     $testFilePath = $this->uploadDirectory . '/' . $hash;
     file_put_contents($testFilePath, $someJunk);
     $file = m::mock('Symfony\\Component\\HttpFoundation\\File\\File')->shouldReceive('getPathname')->andReturn($testFilePath)->getMock();
     $this->mockFileSystem->shouldReceive('exists')->with($testFilePath)->andReturn(true);
     $this->mockFileSystem->shouldReceive('move');
     $newHash = $this->tempFileSystem->storeFile($file, false);
     $newFile = $this->tempFileSystem->getFile($newHash);
     $this->assertSame($hash, $newHash);
     $this->assertSame(file_get_contents($newFile->getPathname()), $someJunk);
 }
开发者ID:stopfstedt,项目名称:ilios,代码行数:15,代码来源:TemporaryFileSystemTest.php

示例2: testCheckLearningMaterialFilePath

 public function testCheckLearningMaterialFilePath()
 {
     $goodLm = m::mock('Ilios\\CoreBundle\\Entity\\LearningMaterial')->shouldReceive('getRelativePath')->andReturn('goodfile')->mock();
     $badLm = m::mock('Ilios\\CoreBundle\\Entity\\LearningMaterial')->shouldReceive('getRelativePath')->andReturn('badfile')->mock();
     $this->mockFileSystem->shouldReceive('exists')->with($this->fakeTestFileDir . '/goodfile')->andReturn(true)->once();
     $this->mockFileSystem->shouldReceive('exists')->with($this->fakeTestFileDir . '/badfile')->andReturn(false)->once();
     $this->assertTrue($this->iliosFileSystem->checkLearningMaterialFilePath($goodLm));
     $this->assertFalse($this->iliosFileSystem->checkLearningMaterialFilePath($badLm));
 }
开发者ID:stopfstedt,项目名称:ilios,代码行数:9,代码来源:IliosFileSystemTest.php

示例3: testGetFile

 public function testGetFile()
 {
     $fs = new SymfonyFileSystem();
     $someJunk = 'whatever dude';
     $hash = md5($someJunk);
     $hashDirectory = substr($hash, 0, 2);
     $parts = [$this->fakeTestFileDir, 'learning_materials', 'lm', $hashDirectory];
     $dir = implode($parts, '/');
     $fs->mkdir($dir);
     $testFilePath = $dir . '/' . $hash;
     file_put_contents($testFilePath, $someJunk);
     $file = m::mock('Symfony\\Component\\HttpFoundation\\File\\File')->shouldReceive('getPathname')->andReturn($testFilePath)->getMock();
     $this->mockFileSystem->shouldReceive('exists')->with($testFilePath)->andReturn(true);
     $this->mockFileSystem->shouldReceive('mkdir');
     $newPath = $this->iliosFileSystem->storeLearningMaterialFile($file, false);
     $newFile = $this->iliosFileSystem->getFile($newPath);
     $this->assertSame($newFile->getPathname(), $testFilePath);
     $this->assertSame(file_get_contents($newFile->getPathname()), $someJunk);
     $fs->remove($this->fakeTestFileDir . '/learning_materials');
 }
开发者ID:Okami-,项目名称:ilios,代码行数:20,代码来源:IliosFileSystemTest.php


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