@@ -38,9 +38,11 @@ public function setUp()
3838 ]);
3939 }
4040
41- public function testValidConstructorFileDocument ()
41+ public function testGetFile ()
4242 {
43- new ReadableStream ($ this ->collectionWrapper , (object ) ['_id ' => null , 'chunkSize ' => 1 , 'length ' => 0 ]);
43+ $ fileDocument = (object ) ['_id ' => null , 'chunkSize ' => 1 , 'length ' => 0 ];
44+ $ stream = new ReadableStream ($ this ->collectionWrapper , $ fileDocument );
45+ $ this ->assertSame ($ fileDocument , $ stream ->getFile ());
4446 }
4547
4648 /**
@@ -108,14 +110,22 @@ public function provideFileIdAndExpectedBytes()
108110 ];
109111 }
110112
113+ public function provideFilteredFileIdAndExpectedBytes ()
114+ {
115+ return array_filter ($ this ->provideFileIdAndExpectedBytes (),
116+ function (array $ args ) {
117+ return $ args [1 ] > 0 ;
118+ }
119+ );
120+ }
121+
111122 /**
112- * @dataProvider provideFileIdAndExpectedBytes
123+ * @dataProvider provideFilteredFileIdAndExpectedBytes
113124 */
114125 public function testReadBytesCalledMultipleTimes ($ fileId , $ length , $ expectedBytes )
115126 {
116127 $ fileDocument = $ this ->collectionWrapper ->findFileById ($ fileId );
117128 $ stream = new ReadableStream ($ this ->collectionWrapper , $ fileDocument );
118-
119129 for ($ i = 0 ; $ i < $ length ; $ i ++) {
120130 $ expectedByte = isset ($ expectedBytes [$ i ]) ? $ expectedBytes [$ i ] : '' ;
121131 $ this ->assertSame ($ expectedByte , $ stream ->readBytes (1 ));
0 commit comments