diff options
| author | EoleDev <root@serverpc.home> | 2016-03-09 16:03:46 +0100 |
|---|---|---|
| committer | EoleDev <root@serverpc.home> | 2016-03-09 16:03:46 +0100 |
| commit | 03ef74d0cfe675a6e18a91f039182ca1b248d8f5 (patch) | |
| tree | b1668c59fdbf9cb0b0a3da52bfc79e393a953573 /server/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php | |
| parent | 1d3ed3af6d57316640c143002ddf80d61e6c098a (diff) | |
MAJ Librarys
Diffstat (limited to 'server/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php')
| -rw-r--r-- | server/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/server/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php b/server/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php index 326f754..60a2636 100644 --- a/server/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php +++ b/server/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php @@ -98,6 +98,33 @@ class CachingStreamTest extends \PHPUnit_Framework_TestCase $this->assertEquals('ing', $this->body->read(3)); } + public function testCanSeekToReadBytesWithPartialBodyReturned() + { + $stream = fopen('php://temp', 'r+'); + fwrite($stream, 'testing'); + fseek($stream, 0); + + $this->decorated = $this->getMockBuilder('\GuzzleHttp\Psr7\Stream') + ->setConstructorArgs([$stream]) + ->setMethods(['read']) + ->getMock(); + + $this->decorated->expects($this->exactly(2)) + ->method('read') + ->willReturnCallback(function($length) use ($stream){ + return fread($stream, 2); + }); + + $this->body = new CachingStream($this->decorated); + + $this->assertEquals(0, $this->body->tell()); + $this->body->seek(4, SEEK_SET); + $this->assertEquals(4, $this->body->tell()); + + $this->body->seek(0); + $this->assertEquals('test', $this->body->read(4)); + } + public function testWritesToBufferStream() { $this->body->read(2); |
