diff options
| author | root <root@kabir-PC> | 2016-03-23 11:31:51 +0100 |
|---|---|---|
| committer | root <root@kabir-PC> | 2016-03-23 11:31:51 +0100 |
| commit | a26989103d70fb0dd3ff6834de107cae246778c3 (patch) | |
| tree | 0f243c83b790ffb57f19261fc2a509131f6776ce /server/vendor/guzzlehttp/psr7/tests | |
| parent | 1342db60283cb61a1c3810993575d35b9fb33ac0 (diff) | |
| parent | 6e78d76f887d1149ea85bfb06db7ee7ad7435f5a (diff) | |
Merge branch 'develop' of https://github.com/manzerbredes/istic-openstack into develop
Diffstat (limited to 'server/vendor/guzzlehttp/psr7/tests')
| -rw-r--r-- | server/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php | 27 | ||||
| -rw-r--r-- | server/vendor/guzzlehttp/psr7/tests/InflateStreamTest.php | 23 | ||||
| -rw-r--r-- | server/vendor/guzzlehttp/psr7/tests/UriTest.php | 2 |
3 files changed, 51 insertions, 1 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); diff --git a/server/vendor/guzzlehttp/psr7/tests/InflateStreamTest.php b/server/vendor/guzzlehttp/psr7/tests/InflateStreamTest.php index 927fc0b..0e4b586 100644 --- a/server/vendor/guzzlehttp/psr7/tests/InflateStreamTest.php +++ b/server/vendor/guzzlehttp/psr7/tests/InflateStreamTest.php @@ -13,4 +13,27 @@ class InflateStreamtest extends \PHPUnit_Framework_TestCase $b = new InflateStream($a); $this->assertEquals('test', (string) $b); } + + public function testInflatesStreamsWithFilename() + { + $content = $this->getGzipStringWithFilename('test'); + $a = Psr7\stream_for($content); + $b = new InflateStream($a); + $this->assertEquals('test', (string) $b); + } + + private function getGzipStringWithFilename($original_string) + { + $gzipped = bin2hex(gzencode($original_string)); + + $header = substr($gzipped, 0, 20); + // set FNAME flag + $header[6]=0; + $header[7]=8; + // make a dummy filename + $filename = "64756d6d7900"; + $rest = substr($gzipped, 20); + + return hex2bin($header . $filename . $rest); + } } diff --git a/server/vendor/guzzlehttp/psr7/tests/UriTest.php b/server/vendor/guzzlehttp/psr7/tests/UriTest.php index a63293c..357ee25 100644 --- a/server/vendor/guzzlehttp/psr7/tests/UriTest.php +++ b/server/vendor/guzzlehttp/psr7/tests/UriTest.php @@ -154,7 +154,7 @@ class UriTest extends \PHPUnit_Framework_TestCase [self::RFC3986_BASE, 'g;x=1/../y', 'http://a/b/c/y'], ['http://u@a/b/c/d;p?q', '.', 'http://u@a/b/c/'], ['http://u:p@a/b/c/d;p?q', '.', 'http://u:p@a/b/c/'], - //[self::RFC3986_BASE, 'http:g', 'http:g'], + ['http://a/b/c/d/', 'e', 'http://a/b/c/d/e'], ]; } |
