summaryrefslogtreecommitdiffstats
path: root/php-guzzlehttp-streams-ad4c07ea55d02789a65ae75f6e4a9ee2cb9dab3f.patch
blob: 0d212aa8cfb022e06f8e33b664d23629866e21f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From ad4c07ea55d02789a65ae75f6e4a9ee2cb9dab3f Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Wed, 21 Jan 2015 13:45:19 +0100
Subject: [PATCH] Fix #29 feof need a failed read

---
 tests/AppendStreamTest.php        | 1 +
 tests/FnStreamTest.php            | 1 +
 tests/GuzzleStreamWrapperTest.php | 1 +
 tests/LimitStreamTest.php         | 1 +
 4 files changed, 4 insertions(+)

diff --git a/tests/AppendStreamTest.php b/tests/AppendStreamTest.php
index a1d302d..2a0adb6 100644
--- a/tests/AppendStreamTest.php
+++ b/tests/AppendStreamTest.php
@@ -109,6 +109,7 @@ public function testCanReadFromMultipleStreams()
         $this->assertEquals('foo', $a->read(3));
         $this->assertEquals('bar', $a->read(3));
         $this->assertEquals('baz', $a->read(3));
+        $this->assertEmpty($a->read(1));
         $this->assertTrue($a->eof());
         $this->assertSame(9, $a->tell());
         $this->assertEquals('foobarbaz', (string) $a);
diff --git a/tests/FnStreamTest.php b/tests/FnStreamTest.php
index 39b495b..0597a7a 100644
--- a/tests/FnStreamTest.php
+++ b/tests/FnStreamTest.php
@@ -59,6 +59,7 @@ public function testDecoratesStream()
         $this->assertEquals($b->read(3), 'foo');
         $this->assertEquals($b->tell(), 3);
         $this->assertEquals($a->tell(), 3);
+        $this->assertEmpty($b->read(1));
         $this->assertEquals($b->eof(), true);
         $this->assertEquals($a->eof(), true);
         $b->seek(0);
diff --git a/tests/GuzzleStreamWrapperTest.php b/tests/GuzzleStreamWrapperTest.php
index 33c3ecc..f10cc78 100644
--- a/tests/GuzzleStreamWrapperTest.php
+++ b/tests/GuzzleStreamWrapperTest.php
@@ -18,6 +18,7 @@ public function testResource()
         $this->assertSame(3, fwrite($handle, 'bar'));
         $this->assertSame(0, fseek($handle, 0));
         $this->assertSame('foobar', fread($handle, 6));
+        $this->assertEmpty(fread($handle, 1));
         $this->assertTrue(feof($handle));
 
         // This fails on HHVM for some reason
diff --git a/tests/LimitStreamTest.php b/tests/LimitStreamTest.php
index efb1dc5..6137e82 100644
--- a/tests/LimitStreamTest.php
+++ b/tests/LimitStreamTest.php
@@ -31,6 +31,7 @@ public function testReturnsSubset()
         $body->seek(0);
         $this->assertFalse($body->eof());
         $this->assertEquals('oo', $body->read(100));
+        $this->assertEmpty($body->read(1));
         $this->assertTrue($body->eof());
     }