Ejemplo n.º 1
0
 public function __construct(StreamInterface $stream)
 {
     // Skip the first 10 bytes
     $stream = new LimitStream($stream, -1, 10);
     $resource = StreamWrapper::getResource($stream);
     stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ);
     parent::__construct(new Stream($resource));
 }
Ejemplo n.º 2
0
 public function testCanOpenReadonlyStream()
 {
     $stream = $this->getMockBuilder('Psr\\Http\\Message\\StreamInterface')->setMethods(array('isReadable', 'isWritable'))->getMockForAbstractClass();
     $stream->expects($this->once())->method('isReadable')->will($this->returnValue(false));
     $stream->expects($this->once())->method('isWritable')->will($this->returnValue(true));
     $r = StreamWrapper::getResource($stream);
     $this->assertInternalType('resource', $r);
     fclose($r);
 }