Skip to content

Commit 8a54470

Browse files
authored
Expect BulkWriteException (#1455)
1 parent 9f4c1c8 commit 8a54470

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tests/UnifiedSpecTests/ExpectedError.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use MongoDB\Driver\Exception\ExecutionTimeoutException;
88
use MongoDB\Driver\Exception\RuntimeException;
99
use MongoDB\Driver\Exception\ServerException;
10-
use MongoDB\Driver\Exception\WriteException;
1110
use MongoDB\Tests\UnifiedSpecTests\Constraint\Matches;
1211
use PHPUnit\Framework\Assert;
1312
use stdClass;
@@ -157,14 +156,14 @@ public function assert(?Throwable $e = null): void
157156
}
158157

159158
if (isset($this->matchesResultDocument)) {
160-
assertThat($e, logicalOr(isInstanceOf(CommandException::class), isInstanceOf(WriteException::class)));
159+
assertThat($e, logicalOr(isInstanceOf(CommandException::class), isInstanceOf(BulkWriteException::class)));
161160

162161
if ($e instanceof CommandException) {
163162
assertThat($e->getResultDocument(), $this->matchesResultDocument, 'CommandException result document matches');
164-
} elseif ($e instanceof WriteException) {
163+
} elseif ($e instanceof BulkWriteException) {
165164
$writeErrors = $e->getWriteResult()->getErrorReplies();
166165
assertCount(1, $writeErrors);
167-
assertThat($writeErrors[0], $this->matchesResultDocument, 'WriteException result document matches');
166+
assertThat($writeErrors[0], $this->matchesResultDocument, 'BulkWriteException result document matches');
168167
}
169168
}
170169

0 commit comments

Comments
 (0)