Skip to content

Commit 9fd9bb1

Browse files
committed
Merge pull request #520
2 parents 986e21e + 0d0561a commit 9fd9bb1

File tree

4 files changed

+91
-2
lines changed

4 files changed

+91
-2
lines changed

tests/replicaset/bug0898-001.phpt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
--TEST--
2+
PHPC-898: readConcern option should not be included in getMore commands (URI option)
3+
--SKIPIF--
4+
<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("REPLICASET"); ?>
5+
<?php CLEANUP(REPLICASET); ?>
6+
--FILE--
7+
<?php
8+
require_once __DIR__ . "/../utils/basic.inc";
9+
10+
$manager = new MongoDB\Driver\Manager(REPLICASET, ['readConcernLevel' => 'local']);
11+
12+
$bulk = new MongoDB\Driver\BulkWrite();
13+
$bulk->insert(['_id' => 1]);
14+
$bulk->insert(['_id' => 2]);
15+
$bulk->insert(['_id' => 3]);
16+
17+
$result = $manager->executeBulkWrite(NS, $bulk);
18+
printf("Inserted %d document(s)\n", $result->getInsertedCount());
19+
20+
$query = new MongoDB\Driver\Query([], ['batchSize' => 2]);
21+
$cursor = $manager->executeQuery(NS, $query);
22+
23+
foreach ($cursor as $document) {
24+
var_dump($document);
25+
}
26+
27+
?>
28+
===DONE===
29+
<?php exit(0); ?>
30+
--EXPECTF--
31+
Inserted 3 document(s)
32+
object(stdClass)#%d (1) {
33+
["_id"]=>
34+
int(1)
35+
}
36+
object(stdClass)#%d (1) {
37+
["_id"]=>
38+
int(2)
39+
}
40+
object(stdClass)#%d (1) {
41+
["_id"]=>
42+
int(3)
43+
}
44+
===DONE===

tests/replicaset/bug0898-002.phpt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
--TEST--
2+
PHPC-898: readConcern option should not be included in getMore commands (query option)
3+
--SKIPIF--
4+
<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("REPLICASET"); ?>
5+
<?php CLEANUP(REPLICASET); ?>
6+
--FILE--
7+
<?php
8+
require_once __DIR__ . "/../utils/basic.inc";
9+
10+
$manager = new MongoDB\Driver\Manager(REPLICASET);
11+
12+
$bulk = new MongoDB\Driver\BulkWrite();
13+
$bulk->insert(['_id' => 1]);
14+
$bulk->insert(['_id' => 2]);
15+
$bulk->insert(['_id' => 3]);
16+
17+
$result = $manager->executeBulkWrite(NS, $bulk);
18+
printf("Inserted %d document(s)\n", $result->getInsertedCount());
19+
20+
$rc = new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::LOCAL);
21+
$query = new MongoDB\Driver\Query([], ['batchSize' => 2, 'readConcern' => $rc]);
22+
$cursor = $manager->executeQuery(NS, $query);
23+
24+
foreach ($cursor as $document) {
25+
var_dump($document);
26+
}
27+
28+
?>
29+
===DONE===
30+
<?php exit(0); ?>
31+
--EXPECTF--
32+
Inserted 3 document(s)
33+
object(stdClass)#%d (1) {
34+
["_id"]=>
35+
int(1)
36+
}
37+
object(stdClass)#%d (1) {
38+
["_id"]=>
39+
int(2)
40+
}
41+
object(stdClass)#%d (1) {
42+
["_id"]=>
43+
int(3)
44+
}
45+
===DONE===

0 commit comments

Comments
 (0)