Skip to content

Commit 3764a60

Browse files
committed
Check exception messages
1 parent 695ddcc commit 3764a60

5 files changed

+25
-20
lines changed

tests/writeResult/writeresult-getdeletedcount-002.phpt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ $bulk->delete(['x' => 1]);
1919

2020
$result = $manager->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(0));
2121

22-
throws(function() use ($result) {
22+
echo throws(function() use ($result) {
2323
$result->getDeletedCount();
24-
}, MongoDB\Driver\Exception\LogicException::class, 'getDeletedCount');
24+
}, MongoDB\Driver\Exception\LogicException::class), "\n";
2525

2626
?>
2727
===DONE===
2828
<?php exit(0); ?>
29-
--EXPECTF--
30-
OK: Got MongoDB\Driver\Exception\LogicException thrown from getDeletedCount
29+
--EXPECT--
30+
OK: Got MongoDB\Driver\Exception\LogicException
31+
MongoDB\Driver\WriteResult::getDeletedCount() should not be called for an unacknowledged write result
3132
===DONE===

tests/writeResult/writeresult-getinsertedcount-002.phpt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ $bulk->delete(['x' => 1]);
1919

2020
$result = $manager->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(0));
2121

22-
throws(function() use ($result) {
22+
echo throws(function() use ($result) {
2323
$result->getInsertedCount();
24-
}, MongoDB\Driver\Exception\LogicException::class, 'getInsertedCount');
24+
}, MongoDB\Driver\Exception\LogicException::class), "\n";
2525

2626
?>
2727
===DONE===
2828
<?php exit(0); ?>
29-
--EXPECTF--
30-
OK: Got MongoDB\Driver\Exception\LogicException thrown from getInsertedCount
29+
--EXPECT--
30+
OK: Got MongoDB\Driver\Exception\LogicException
31+
MongoDB\Driver\WriteResult::getInsertedCount() should not be called for an unacknowledged write result
3132
===DONE===

tests/writeResult/writeresult-getmatchedcount-002.phpt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ $bulk->delete(['x' => 1]);
1919

2020
$result = $manager->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(0));
2121

22-
throws(function() use ($result) {
22+
echo throws(function() use ($result) {
2323
$result->getMatchedCount();
24-
}, MongoDB\Driver\Exception\LogicException::class, 'getMatchedCount');
24+
}, MongoDB\Driver\Exception\LogicException::class), "\n";
2525

2626
?>
2727
===DONE===
2828
<?php exit(0); ?>
29-
--EXPECTF--
30-
OK: Got MongoDB\Driver\Exception\LogicException thrown from getMatchedCount
29+
--EXPECT--
30+
OK: Got MongoDB\Driver\Exception\LogicException
31+
MongoDB\Driver\WriteResult::getMatchedCount() should not be called for an unacknowledged write result
3132
===DONE===

tests/writeResult/writeresult-getmodifiedcount-002.phpt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ $bulk->delete(['x' => 1]);
1919

2020
$result = $manager->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(0));
2121

22-
throws(function() use ($result) {
22+
echo throws(function() use ($result) {
2323
$result->getModifiedCount();
24-
}, MongoDB\Driver\Exception\LogicException::class, 'getModifiedCount');
24+
}, MongoDB\Driver\Exception\LogicException::class), "\n";
2525

2626
?>
2727
===DONE===
2828
<?php exit(0); ?>
29-
--EXPECTF--
30-
OK: Got MongoDB\Driver\Exception\LogicException thrown from getModifiedCount
29+
--EXPECT--
30+
OK: Got MongoDB\Driver\Exception\LogicException
31+
MongoDB\Driver\WriteResult::getModifiedCount() should not be called for an unacknowledged write result
3132
===DONE===

tests/writeResult/writeresult-getupsertedcount-002.phpt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ $bulk->delete(['x' => 1]);
1919

2020
$result = $manager->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(0));
2121

22-
throws(function() use ($result) {
22+
echo throws(function() use ($result) {
2323
$result->getUpsertedCount();
24-
}, MongoDB\Driver\Exception\LogicException::class, 'getUpsertedCount');
24+
}, MongoDB\Driver\Exception\LogicException::class), "\n";
2525

2626
?>
2727
===DONE===
2828
<?php exit(0); ?>
29-
--EXPECTF--
30-
OK: Got MongoDB\Driver\Exception\LogicException thrown from getUpsertedCount
29+
--EXPECT--
30+
OK: Got MongoDB\Driver\Exception\LogicException
31+
MongoDB\Driver\WriteResult::getUpsertedCount() should not be called for an unacknowledged write result
3132
===DONE===

0 commit comments

Comments
 (0)