@@ -190,6 +190,55 @@ public function testSelectCollectionPassesOptions()
190190 $ this ->assertSame (WriteConcern::MAJORITY , $ debug ['writeConcern ' ]->getW ());
191191 }
192192
193+ public function testSelectGridFSBucketInheritsOptions ()
194+ {
195+ $ databaseOptions = [
196+ 'readConcern ' => new ReadConcern (ReadConcern::LOCAL ),
197+ 'readPreference ' => new ReadPreference (ReadPreference::RP_SECONDARY_PREFERRED ),
198+ 'writeConcern ' => new WriteConcern (WriteConcern::MAJORITY ),
199+ ];
200+
201+ $ database = new Database ($ this ->manager , $ this ->getDatabaseName (), $ databaseOptions );
202+ $ bucket = $ database ->selectGridFSBucket ();
203+ $ debug = $ bucket ->__debugInfo ();
204+
205+ $ this ->assertSame ($ this ->manager , $ debug ['manager ' ]);
206+ $ this ->assertSame ($ this ->getDatabaseName (), $ debug ['databaseName ' ]);
207+ $ this ->assertSame ('fs ' , $ debug ['bucketName ' ]);
208+ $ this ->assertSame (261120 , $ debug ['chunkSizeBytes ' ]);
209+ $ this ->assertInstanceOf ('MongoDB\Driver\ReadConcern ' , $ debug ['readConcern ' ]);
210+ $ this ->assertSame (ReadConcern::LOCAL , $ debug ['readConcern ' ]->getLevel ());
211+ $ this ->assertInstanceOf ('MongoDB\Driver\ReadPreference ' , $ debug ['readPreference ' ]);
212+ $ this ->assertSame (ReadPreference::RP_SECONDARY_PREFERRED , $ debug ['readPreference ' ]->getMode ());
213+ $ this ->assertInstanceOf ('MongoDB\Driver\WriteConcern ' , $ debug ['writeConcern ' ]);
214+ $ this ->assertSame (WriteConcern::MAJORITY , $ debug ['writeConcern ' ]->getW ());
215+ }
216+
217+ public function testSelectGridFSBucketPassesOptions ()
218+ {
219+ $ bucketOptions = [
220+ 'bucketName ' => 'custom_fs ' ,
221+ 'chunkSizeBytes ' => 8192 ,
222+ 'readConcern ' => new ReadConcern (ReadConcern::LOCAL ),
223+ 'readPreference ' => new ReadPreference (ReadPreference::RP_SECONDARY_PREFERRED ),
224+ 'writeConcern ' => new WriteConcern (WriteConcern::MAJORITY ),
225+ ];
226+
227+ $ database = new Database ($ this ->manager , $ this ->getDatabaseName ());
228+ $ bucket = $ database ->selectGridFSBucket ($ bucketOptions );
229+ $ debug = $ bucket ->__debugInfo ();
230+
231+ $ this ->assertSame ($ this ->getDatabaseName (), $ debug ['databaseName ' ]);
232+ $ this ->assertSame ('custom_fs ' , $ debug ['bucketName ' ]);
233+ $ this ->assertSame (8192 , $ debug ['chunkSizeBytes ' ]);
234+ $ this ->assertInstanceOf ('MongoDB\Driver\ReadConcern ' , $ debug ['readConcern ' ]);
235+ $ this ->assertSame (ReadConcern::LOCAL , $ debug ['readConcern ' ]->getLevel ());
236+ $ this ->assertInstanceOf ('MongoDB\Driver\ReadPreference ' , $ debug ['readPreference ' ]);
237+ $ this ->assertSame (ReadPreference::RP_SECONDARY_PREFERRED , $ debug ['readPreference ' ]->getMode ());
238+ $ this ->assertInstanceOf ('MongoDB\Driver\WriteConcern ' , $ debug ['writeConcern ' ]);
239+ $ this ->assertSame (WriteConcern::MAJORITY , $ debug ['writeConcern ' ]->getW ());
240+ }
241+
193242 public function testWithOptionsInheritsOptions ()
194243 {
195244 $ databaseOptions = [
0 commit comments