File tree 2 files changed +17
-2
lines changed 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,13 @@ public function __construct(
36
36
37
37
public function getSize ()
38
38
{
39
- return max ($ this ->stream ->getSize (), $ this ->remoteStream ->getSize ());
39
+ $ remoteSize = $ this ->remoteStream ->getSize ();
40
+
41
+ if (null === $ remoteSize ) {
42
+ return null ;
43
+ }
44
+
45
+ return max ($ this ->stream ->getSize (), $ remoteSize );
40
46
}
41
47
42
48
public function rewind ()
Original file line number Diff line number Diff line change @@ -34,13 +34,22 @@ public function tearDownTest()
34
34
$ this ->body ->close ();
35
35
}
36
36
37
- public function testUsesRemoteSizeIfPossible ()
37
+ public function testUsesRemoteSizeIfAvailable ()
38
38
{
39
39
$ body = Psr7 \Utils::streamFor ('test ' );
40
40
$ caching = new CachingStream ($ body );
41
41
self ::assertSame (4 , $ caching ->getSize ());
42
42
}
43
43
44
+ public function testUsesRemoteSizeIfNotAvailable ()
45
+ {
46
+ $ body = new Psr7 \PumpStream (function () {
47
+ return 'a ' ;
48
+ });
49
+ $ caching = new CachingStream ($ body );
50
+ self ::assertNull ($ caching ->getSize ());
51
+ }
52
+
44
53
public function testReadsUntilCachedToByte ()
45
54
{
46
55
$ this ->body ->seek (5 );
You can’t perform that action at this time.
0 commit comments