@@ -194,7 +194,7 @@ public function testDownloadToStreamShouldRequireDestinationStream($destination)
194
194
195
195
public function provideInvalidStreamValues ()
196
196
{
197
- return $ this ->wrapValuesForDataProvider ([ null , 123 , ' foo ' , [], hash_init ( ' md5 ' )] );
197
+ return $ this ->wrapValuesForDataProvider ($ this -> getInvalidStreamValues () );
198
198
}
199
199
200
200
/**
@@ -407,13 +407,18 @@ public function testGetFileDocumentForStreamWithWritableStream()
407
407
408
408
/**
409
409
* @expectedException MongoDB\Exception\InvalidArgumentException
410
- * @dataProvider provideInvalidStreamValues
410
+ * @dataProvider provideInvalidGridFSStreamValues
411
411
*/
412
- public function testGetFileDocumentForStreamShouldRequireStreamResource ($ stream )
412
+ public function testGetFileDocumentForStreamShouldRequireGridFSStreamResource ($ stream )
413
413
{
414
414
$ this ->bucket ->getFileDocumentForStream ($ stream );
415
415
}
416
416
417
+ public function provideInvalidGridFSStreamValues ()
418
+ {
419
+ return $ this ->wrapValuesForDataProvider (array_merge ($ this ->getInvalidStreamValues (), [$ this ->createStream ()]));
420
+ }
421
+
417
422
public function testGetFileIdForStreamUsesTypeMap ()
418
423
{
419
424
$ stream = $ this ->bucket ->openUploadStream ('filename ' , ['_id ' => ['x ' => 1 ]]);
@@ -441,9 +446,9 @@ public function testGetFileIdForStreamWithWritableStream()
441
446
442
447
/**
443
448
* @expectedException MongoDB\Exception\InvalidArgumentException
444
- * @dataProvider provideInvalidStreamValues
449
+ * @dataProvider provideInvalidGridFSStreamValues
445
450
*/
446
- public function testGetFileIdForStreamShouldRequireStreamResource ($ stream )
451
+ public function testGetFileIdForStreamShouldRequireGridFSStreamResource ($ stream )
447
452
{
448
453
$ this ->bucket ->getFileIdForStream ($ stream );
449
454
}
@@ -714,4 +719,14 @@ private function assertIndexExists($collectionName, $indexName, $callback = null
714
719
call_user_func ($ callback , $ foundIndex );
715
720
}
716
721
}
722
+
723
+ /**
724
+ * Return a list of invalid stream values.
725
+ *
726
+ * @return array
727
+ */
728
+ private function getInvalidStreamValues ()
729
+ {
730
+ return [null , 123 , 'foo ' , [], hash_init ('md5 ' )];
731
+ }
717
732
}
0 commit comments