Skip to content

Commit ac9da79

Browse files
committed
WriteConcernError test
1 parent 907d9b0 commit ac9da79

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
--TEST--
2+
WriteConcernError: Populate WriteConcernError on WriteConcern errors
3+
--SKIPIF--
4+
<?php require "tests/utils/basic-skipif.inc"?>
5+
--FILE--
6+
<?php
7+
require_once "tests/utils/basic.inc";
8+
9+
$mc = new MongoDB\Driver\Manager(MONGODB_REPLICASET_URI);
10+
11+
$batch = new MongoDB\Driver\WriteBatch;
12+
13+
$batch->insert(array("my" => "value"));
14+
15+
$w = new MongoDB\Driver\WriteConcern(30, 100);
16+
$retval = $mc->executeWriteBatch(NS, $batch, $w);
17+
18+
printWriteResult($retval);
19+
?>
20+
===DONE===
21+
<?php exit(0); ?>
22+
--EXPECTF--
23+
server: %s:%d
24+
insertedCount: 1
25+
matchedCount: 0
26+
modifiedCount: 0
27+
upsertedCount: 0
28+
deletedCount: 0
29+
writeConcernError.message: waiting for replication timed out
30+
writeConcernError.code: 64
31+
writeConcernError.info: array(1) {
32+
["wtimeout"]=>
33+
bool(true)
34+
}
35+
===DONE===

0 commit comments

Comments
 (0)