33namespace MongoDB \Tests \SpecTests \Crud ;
44
55use MongoDB \ClientBulkWrite ;
6- use MongoDB \Driver \Exception \BulkWriteCommandException ;
76use MongoDB \Driver \Exception \InvalidArgumentException ;
87use MongoDB \Tests \SpecTests \FunctionalTestCase ;
98
@@ -41,12 +40,8 @@ public function testDocumentTooLarge(): void
4140 try {
4241 $ client ->bulkWrite ($ bulkWrite );
4342 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 ::assertContains ('unable to send document ' , $ e ->getMessage ());
5045 }
5146 }
5247
@@ -65,12 +60,8 @@ public function testNamespaceTooLarge(): void
6560 try {
6661 $ client ->bulkWrite ($ bulkWrite );
6762 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 ::assertContains ('unable to send document ' , $ e ->getMessage ());
7465 }
7566 }
7667}
0 commit comments