@@ -230,6 +230,7 @@ public function testStoreFileResource()
230
230
231
231
public function testStoreUpload ()
232
232
{
233
+ $ this ->skipTestIf (extension_loaded ('mongo ' ));
233
234
$ collection = $ this ->getGridFS ();
234
235
235
236
$ _FILES ['foo ' ] = [
@@ -303,7 +304,7 @@ public function testStoreByteExceptionWhileInsertingRecord()
303
304
$ document = ['_id ' => $ id ];
304
305
$ collection ->insert ($ document );
305
306
306
- $ this ->setExpectedException ('MongoGridFSException ' , 'Cannot insert file record ' );
307
+ $ this ->setExpectedExceptionRegExp ('MongoGridFSException ' , '/Could not store file: localhost:27017: E11000 duplicate key error .* mongo-php-adapter\.fs\.files/ ' );
307
308
308
309
$ collection ->storeBytes ('foo ' , ['_id ' => $ id ]);
309
310
}
@@ -316,7 +317,7 @@ public function testStoreByteExceptionWhileInsertingChunks()
316
317
$ document = ['n ' => 0 ];
317
318
$ collection ->chunks ->insert ($ document );
318
319
319
- $ this ->setExpectedException ('MongoGridFSException ' , 'Error while inserting chunks ' );
320
+ $ this ->setExpectedExceptionRegExp ('MongoGridFSException ' , '/Could not store file: localhost:27017: E11000 duplicate key error .* mongo-php-adapter\.fs\. chunks/ ' );
320
321
321
322
$ collection ->storeBytes ('foo ' );
322
323
}
@@ -329,7 +330,7 @@ public function testStoreFileExceptionWhileInsertingRecord()
329
330
$ document = ['_id ' => $ id ];
330
331
$ collection ->insert ($ document );
331
332
332
- $ this ->setExpectedException ('MongoGridFSException ' , 'Cannot insert file record ' );
333
+ $ this ->setExpectedExceptionRegExp ('MongoGridFSException ' , '/Could not store file: localhost:27017: E11000 duplicate key error .* mongo-php-adapter\.fs\.files/ ' );
333
334
334
335
$ collection ->storeFile (__FILE__ , ['_id ' => $ id ]);
335
336
}
@@ -342,7 +343,7 @@ public function testStoreFileExceptionWhileInsertingChunks()
342
343
$ document = ['n ' => 0 ];
343
344
$ collection ->chunks ->insert ($ document );
344
345
345
- $ this ->setExpectedException ('MongoGridFSException ' , 'Error while inserting chunks ' );
346
+ $ this ->setExpectedExceptionRegExp ('MongoGridFSException ' , '/Could not store file: localhost:27017: E11000 duplicate key error .* mongo-php-adapter\.fs\. chunks/ ' );
346
347
347
348
$ collection ->storeFile (__FILE__ );
348
349
}
@@ -355,7 +356,7 @@ public function testStoreFileExceptionWhileUpdatingFileRecord()
355
356
$ document = ['length ' => filesize (__FILE__ )];
356
357
$ collection ->insert ($ document );
357
358
358
- $ this ->setExpectedException ('MongoGridFSException ' , 'Error updating file record ' );
359
+ $ this ->setExpectedExceptionRegExp ('MongoGridFSException ' , '/Could not store file: localhost:27017: E11000 duplicate key error .* mongo-php-adapter\.fs\.files/ ' );
359
360
360
361
$ collection ->storeFile (fopen (__FILE__ , 'r ' ));
361
362
}
0 commit comments