Skip to content

Commit aa125b3

Browse files
committed
Revert "Explicitly rewind in-memory streams before asserting contents"
This reverts commit b251eb2, since readable GridFS streams now support seeking.
1 parent 480da55 commit aa125b3

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

tests/GridFS/BucketFunctionalTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ public function testDownloadToStream($input)
187187
$id = $this->bucket->uploadFromStream('filename', $this->createStream($input));
188188
$destination = $this->createStream();
189189
$this->bucket->downloadToStream($id, $destination);
190-
rewind($destination);
191190

192191
$this->assertStreamContents($input, $destination);
193192
}
@@ -222,37 +221,30 @@ public function testDownloadToStreamByName()
222221

223222
$destination = $this->createStream();
224223
$this->bucket->downloadToStreamByName('filename', $destination);
225-
rewind($destination);
226224
$this->assertStreamContents('baz', $destination);
227225

228226
$destination = $this->createStream();
229227
$this->bucket->downloadToStreamByName('filename', $destination, ['revision' => -3]);
230-
rewind($destination);
231228
$this->assertStreamContents('foo', $destination);
232229

233230
$destination = $this->createStream();
234231
$this->bucket->downloadToStreamByName('filename', $destination, ['revision' => -2]);
235-
rewind($destination);
236232
$this->assertStreamContents('bar', $destination);
237233

238234
$destination = $this->createStream();
239235
$this->bucket->downloadToStreamByName('filename', $destination, ['revision' => -1]);
240-
rewind($destination);
241236
$this->assertStreamContents('baz', $destination);
242237

243238
$destination = $this->createStream();
244239
$this->bucket->downloadToStreamByName('filename', $destination, ['revision' => 0]);
245-
rewind($destination);
246240
$this->assertStreamContents('foo', $destination);
247241

248242
$destination = $this->createStream();
249243
$this->bucket->downloadToStreamByName('filename', $destination, ['revision' => 1]);
250-
rewind($destination);
251244
$this->assertStreamContents('bar', $destination);
252245

253246
$destination = $this->createStream();
254247
$this->bucket->downloadToStreamByName('filename', $destination, ['revision' => 2]);
255-
rewind($destination);
256248
$this->assertStreamContents('baz', $destination);
257249
}
258250

tests/GridFS/FunctionalTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected function assertStreamContents($expectedContents, $stream)
3838
{
3939
$this->assertInternalType('resource', $stream);
4040
$this->assertSame('stream', get_resource_type($stream));
41-
$this->assertEquals($expectedContents, stream_get_contents($stream));
41+
$this->assertEquals($expectedContents, stream_get_contents($stream, -1, 0));
4242
}
4343

4444
/**

0 commit comments

Comments
 (0)