コード例 #1
0
 public function testReadStream()
 {
     $stream = tmpfile();
     $mock = $this->getS3Client();
     $mock->shouldReceive('getObject')->once()->andReturn(Mockery::self());
     $mock->shouldReceive('getAll')->once()->andReturn(['ContentLength' => 10, 'ContentType' => 'text/plain', 'Body' => $mock, 'Key' => 'file.ext']);
     $mock->shouldReceive('getStream')->andReturn($stream);
     $mock->shouldReceive('detachStream');
     $adapter = new Adapter($mock, 'bucketname');
     $result = $adapter->readStream('file.ext');
     $this->assertInternalType('resource', $result['stream']);
     fclose($stream);
 }