public function testReadsOnlySubsetOfData() { $data = $this->body->read(100); $this->assertEquals(10, strlen($data)); $this->assertFalse($this->body->read(1000)); $this->body->setOffset(10); $newData = $this->body->read(100); $this->assertEquals(10, strlen($newData)); $this->assertNotSame($data, $newData); }
/** * @expectedException \GuzzleHttp\Stream\Exception\SeekException * @expectedExceptionMessage Could not seek the stream to position 2 */ public function testThrowsWhenCurrentGreaterThanOffsetSeek() { $a = Stream::factory('foo_bar'); $b = new NoSeekStream($a); $c = new LimitStream($b); $a->getContents(); $c->setOffset(2); }