コード例 #1
0
ファイル: WebDavTests.php プロジェクト: robertdamoc/flysystem
 public function testHas()
 {
     $mock = $this->getClient();
     $mock->shouldReceive('propFind')->once()->andReturn(array('{DAV:}getcontentlength' => 20));
     $adapter = new Filesystem(new Adapter($mock));
     $this->assertTrue($adapter->has('something'));
 }
コード例 #2
0
 public function testReadStream()
 {
     $adapter = Mockery::mock('Concrete\\Flysystem\\AdapterInterface');
     $adapter->shouldReceive('has')->andReturn(true);
     $adapter->shouldReceive('readStream')->twice()->andReturn(array('stream' => 'this result'), false);
     $filesystem = new Filesystem($adapter);
     $this->assertEquals('this result', $filesystem->readStream('file.txt'));
     $this->assertFalse($filesystem->readStream('other.txt'));
     // Another time to hit the cache
     $this->assertEquals('this result', $filesystem->readStream('file.txt'));
 }
コード例 #3
0
 public function testReadAndDeleteFail()
 {
     $path = 'path.ext';
     $expected = false;
     $mock = Mockery::mock('Concrete\\Flysystem\\Adapter\\AbstractAdapter[has,read,delete]');
     $adapter = new Filesystem($mock);
     $mock->shouldReceive('has')->andReturn(true);
     $mock->shouldReceive('read')->once()->with($path)->andReturn($expected);
     $result = $adapter->readAndDelete($path);
     $this->assertEquals($expected, $result);
 }