Skip to content

Commit bb34d7f

Browse files
committed
PHPLIB-1677: Assert unset BulkWriteException.partialResult in CRUD prose tests
1 parent f207cdb commit bb34d7f

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

tests/SpecTests/Crud/Prose12_BulkWriteExceedsMaxMessageSizeBytesTest.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace MongoDB\Tests\SpecTests\Crud;
44

55
use MongoDB\ClientBulkWrite;
6-
use MongoDB\Driver\Exception\BulkWriteCommandException;
76
use MongoDB\Driver\Exception\InvalidArgumentException;
87
use 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::assertStringContainsString('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::assertStringContainsString('unable to send document', $e->getMessage());
7465
}
7566
}
7667
}

0 commit comments

Comments
 (0)