summaryrefslogtreecommitdiff
path: root/server/vendor/guzzlehttp/psr7/tests/FnStreamTest.php
diff options
context:
space:
mode:
authorLoic GUEGAN <loic@Manzerbredes.home>2016-04-16 19:10:27 +0200
committerLoic GUEGAN <loic@Manzerbredes.home>2016-04-16 19:10:27 +0200
commita3ff4d243e2ac37d4516ae56ff86985eadc00eb8 (patch)
tree32e71c42855cc46d95d9c6b74ad2c145eb9ec7eb /server/vendor/guzzlehttp/psr7/tests/FnStreamTest.php
parent396c90f921c30de2d15d2ce52d5d1beabf8eb52d (diff)
parent31d2d0c158ad4daa3dde7a905f3c2e312c194f2e (diff)
Test
Diffstat (limited to 'server/vendor/guzzlehttp/psr7/tests/FnStreamTest.php')
-rwxr-xr-xserver/vendor/guzzlehttp/psr7/tests/FnStreamTest.php90
1 files changed, 0 insertions, 90 deletions
diff --git a/server/vendor/guzzlehttp/psr7/tests/FnStreamTest.php b/server/vendor/guzzlehttp/psr7/tests/FnStreamTest.php
deleted file mode 100755
index 66ae90a..0000000
--- a/server/vendor/guzzlehttp/psr7/tests/FnStreamTest.php
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-namespace GuzzleHttp\Tests\Psr7;
-
-use GuzzleHttp\Psr7;
-use GuzzleHttp\Psr7\FnStream;
-
-/**
- * @covers GuzzleHttp\Psr7\FnStream
- */
-class FnStreamTest extends \PHPUnit_Framework_TestCase
-{
- /**
- * @expectedException \BadMethodCallException
- * @expectedExceptionMessage seek() is not implemented in the FnStream
- */
- public function testThrowsWhenNotImplemented()
- {
- (new FnStream([]))->seek(1);
- }
-
- public function testProxiesToFunction()
- {
- $s = new FnStream([
- 'read' => function ($len) {
- $this->assertEquals(3, $len);
- return 'foo';
- }
- ]);
-
- $this->assertEquals('foo', $s->read(3));
- }
-
- public function testCanCloseOnDestruct()
- {
- $called = false;
- $s = new FnStream([
- 'close' => function () use (&$called) {
- $called = true;
- }
- ]);
- unset($s);
- $this->assertTrue($called);
- }
-
- public function testDoesNotRequireClose()
- {
- $s = new FnStream([]);
- unset($s);
- }
-
- public function testDecoratesStream()
- {
- $a = Psr7\stream_for('foo');
- $b = FnStream::decorate($a, []);
- $this->assertEquals(3, $b->getSize());
- $this->assertEquals($b->isWritable(), true);
- $this->assertEquals($b->isReadable(), true);
- $this->assertEquals($b->isSeekable(), true);
- $this->assertEquals($b->read(3), 'foo');
- $this->assertEquals($b->tell(), 3);
- $this->assertEquals($a->tell(), 3);
- $this->assertSame('', $a->read(1));
- $this->assertEquals($b->eof(), true);
- $this->assertEquals($a->eof(), true);
- $b->seek(0);
- $this->assertEquals('foo', (string) $b);
- $b->seek(0);
- $this->assertEquals('foo', $b->getContents());
- $this->assertEquals($a->getMetadata(), $b->getMetadata());
- $b->seek(0, SEEK_END);
- $b->write('bar');
- $this->assertEquals('foobar', (string) $b);
- $this->assertInternalType('resource', $b->detach());
- $b->close();
- }
-
- public function testDecoratesWithCustomizations()
- {
- $called = false;
- $a = Psr7\stream_for('foo');
- $b = FnStream::decorate($a, [
- 'read' => function ($len) use (&$called, $a) {
- $called = true;
- return $a->read($len);
- }
- ]);
- $this->assertEquals('foo', $b->read(3));
- $this->assertTrue($called);
- }
-}