@@ -44,9 +44,9 @@ public function testCanSeekNearEndWithSeekEnd()
44
44
{
45
45
$ baseStream = Psr7 \stream_for (implode ('' , range ('a ' , 'z ' )));
46
46
$ cached = new CachingStream ($ baseStream );
47
- $ cached ->seek (1 , SEEK_END );
48
- $ this ->assertEquals (24 , $ baseStream ->tell ());
49
- $ this ->assertEquals ('y ' , $ cached ->read (1 ));
47
+ $ cached ->seek (- 1 , SEEK_END );
48
+ $ this ->assertEquals (25 , $ baseStream ->tell ());
49
+ $ this ->assertEquals ('z ' , $ cached ->read (1 ));
50
50
$ this ->assertEquals (26 , $ cached ->getSize ());
51
51
}
52
52
@@ -55,8 +55,8 @@ public function testCanSeekToEndWithSeekEnd()
55
55
$ baseStream = Psr7 \stream_for (implode ('' , range ('a ' , 'z ' )));
56
56
$ cached = new CachingStream ($ baseStream );
57
57
$ cached ->seek (0 , SEEK_END );
58
- $ this ->assertEquals (25 , $ baseStream ->tell ());
59
- $ this ->assertEquals ('z ' , $ cached ->read (1 ));
58
+ $ this ->assertEquals (26 , $ baseStream ->tell ());
59
+ $ this ->assertEquals ('' , $ cached ->read (1 ));
60
60
$ this ->assertEquals (26 , $ cached ->getSize ());
61
61
}
62
62
@@ -67,8 +67,8 @@ public function testCanUseSeekEndWithUnknownSize()
67
67
'getSize ' => function () { return null ; }
68
68
]);
69
69
$ cached = new CachingStream ($ decorated );
70
- $ cached ->seek (1 , SEEK_END );
71
- $ this ->assertEquals ('ng ' , $ cached ->read (2 ));
70
+ $ cached ->seek (- 1 , SEEK_END );
71
+ $ this ->assertEquals ('g ' , $ cached ->read (1 ));
72
72
}
73
73
74
74
public function testRewindUsesSeek ()
0 commit comments