3
3
namespace MongoDB \Tests \SpecTests \Crud ;
4
4
5
5
use MongoDB \ClientBulkWrite ;
6
- use MongoDB \Driver \Exception \BulkWriteCommandException ;
7
6
use MongoDB \Driver \Exception \InvalidArgumentException ;
8
7
use MongoDB \Tests \SpecTests \FunctionalTestCase ;
9
8
@@ -41,12 +40,8 @@ public function testDocumentTooLarge(): void
41
40
try {
42
41
$ client ->bulkWrite ($ bulkWrite );
43
42
self ::fail ('Exception was not thrown ' );
44
- } catch (BulkWriteCommandException $ e ) {
45
- /* Note: although the client-side error occurs on the first operation, libmongoc still populates the partial
46
- * result (see: CDRIVER-5969). This causes PHPC to proxy the underlying InvalidArgumentException behind
47
- * BulkWriteCommandException. Until this is addressed, unwrap the error and check the partial result. */
48
- self ::assertInstanceOf (InvalidArgumentException::class, $ e ->getPrevious ());
49
- self ::assertSame (0 , $ e ->getPartialResult ()->getInsertedCount ());
43
+ } catch (InvalidArgumentException $ e ) {
44
+ self ::assertStringContainsString ('unable to send document ' , $ e ->getMessage ());
50
45
}
51
46
}
52
47
@@ -65,12 +60,8 @@ public function testNamespaceTooLarge(): void
65
60
try {
66
61
$ client ->bulkWrite ($ bulkWrite );
67
62
self ::fail ('Exception was not thrown ' );
68
- } catch (BulkWriteCommandException $ e ) {
69
- /* Note: although the client-side error occurs on the first operation, libmongoc still populates the partial
70
- * result (see: CDRIVER-5969). This causes PHPC to proxy the underlying InvalidArgumentException behind
71
- * BulkWriteCommandException. Until this is addressed, unwrap the error and check the partial result. */
72
- self ::assertInstanceOf (InvalidArgumentException::class, $ e ->getPrevious ());
73
- self ::assertSame (0 , $ e ->getPartialResult ()->getInsertedCount ());
63
+ } catch (InvalidArgumentException $ e ) {
64
+ self ::assertStringContainsString ('unable to send document ' , $ e ->getMessage ());
74
65
}
75
66
}
76
67
}
0 commit comments