Skip to content

Commit 87d7024

Browse files
committed
Merge pull request #701
2 parents d66e0e7 + 154ca93 commit 87d7024

15 files changed

+70
-24
lines changed

tests/apm/overview.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ object(MongoDB\Driver\Monitoring\CommandStartedEvent)#%d (%d) {
101101
object(stdClass)#%d (%d) {
102102
["insert"]=>
103103
string(12) "apm_overview"
104-
["writeConcern"]=>
105-
object(stdClass)#%d (%d) {
106-
}
107104
["ordered"]=>
108105
bool(false)%A
109106
}

tests/bulk/bulkwrite-insert_error-001.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ echo throws(function() use ($bulk) {
2828
<?php exit(0); ?>
2929
--EXPECT--
3030
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
31-
document to insert contains invalid key: empty key
31+
invalid document for insert: empty key
3232

3333
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
34-
document to insert contains invalid key: keys cannot contain ".": "x.y"
34+
invalid document for insert: keys cannot contain ".": "x.y"
3535

3636
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
37-
document to insert contains invalid key: keys cannot begin with "$": "$x"
37+
invalid document for insert: keys cannot begin with "$": "$x"
3838

3939
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
40-
document to insert contains invalid key: corrupt BSON
40+
invalid document for insert: corrupt BSON
4141
===DONE===

tests/bulk/bulkwrite-update_error-001.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ echo throws(function() use ($bulk) {
2828
<?php exit(0); ?>
2929
--EXPECT--
3030
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
31-
replacement document contains invalid key: empty key
31+
invalid argument for replace: empty key
3232

3333
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
34-
replacement document contains invalid key: keys cannot contain ".": "x.y"
34+
invalid argument for replace: keys cannot contain ".": "x.y"
3535

3636
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
37-
replacement document contains invalid key: keys cannot begin with "$": "$x"
37+
invalid argument for replace: keys cannot begin with "$": "$x"
3838

3939
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
40-
replacement document contains invalid key: corrupt BSON
40+
invalid argument for replace: corrupt BSON
4141
===DONE===

tests/bulk/bulkwrite-update_error-002.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ echo throws(function() use ($bulk) {
2828
<?php exit(0); ?>
2929
--EXPECT--
3030
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
31-
update document contains invalid key: empty key
31+
invalid argument for update: empty key
3232

3333
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
34-
update document contains invalid key: corrupt BSON
34+
invalid argument for update: corrupt BSON
3535

3636
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
3737
Invalid key 'z': update only works with $ operators

tests/manager/manager-ctor-read_preference-error-001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ echo throws(function() {
5050
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
5151
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?readPreference=1'. Unsupported readPreference value [readPreference=1].
5252
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
53-
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?readPreference=secondary&readPreferenceTags=invalid'. Unknown option or value for 'readPreferenceTags=invalid'.
53+
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?readPreference=secondary&readPreferenceTags=invalid'. Unsupported value for "readPreferenceTags": "invalid".
5454
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
5555
Expected string for "readPreference" URI option, 32-bit integer given
5656
OK: Got MongoDB\Driver\Exception\InvalidArgumentException

tests/manager/manager-ctor-read_preference-error-002.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ echo throws(function() {
5656
<?php exit(0); ?>
5757
--EXPECT--
5858
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
59-
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?readPreference=secondary&maxStalenessSeconds=invalid'. Unknown option or value for 'maxStalenessSeconds=invalid'.
59+
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?readPreference=secondary&maxStalenessSeconds=invalid'. Unsupported value for "maxStalenessSeconds": "invalid".
6060
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
6161
Expected integer for "maxStalenessSeconds" URI option, string given
6262
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
63-
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?readPreference=secondary&maxStalenessSeconds=2147483648'. Unknown option or value for 'maxStalenessSeconds=2147483648'.
63+
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?readPreference=secondary&maxStalenessSeconds=2147483648'. Unsupported value for "maxStalenessSeconds": "2147483648".
6464
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
6565
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?maxstalenessseconds=1231'. Invalid readPreferences.
6666
OK: Got MongoDB\Driver\Exception\InvalidArgumentException

tests/manager/manager-ctor-read_preference-error-003.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ echo throws(function() {
1818
<?php exit(0); ?>
1919
--EXPECT--
2020
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
21-
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?slaveok=other'. Unknown option or value for 'slaveok=other'.
21+
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?slaveok=other'. Unsupported value for "slaveok": "other".
2222
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
2323
Expected boolean for "slaveOk" URI option, 32-bit integer given
2424
===DONE===

tests/manager/manager-ctor-write_concern-error-003.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ echo throws(function() {
1919
<?php exit(0); ?>
2020
--EXPECT--
2121
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
22-
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?wtimeoutms=invalid'. Unknown option or value for 'wtimeoutms=invalid'.
22+
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?wtimeoutms=invalid'. Unsupported value for "wtimeoutms": "invalid".
2323
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
2424
Expected 32-bit integer for "wTimeoutMS" URI option, string given
2525
===DONE===

tests/manager/manager-ctor-write_concern-error-005.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ echo throws(function() {
5454
<?php exit(0); ?>
5555
--EXPECT--
5656
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
57-
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?journal=invalid'. Unknown option or value for 'journal=invalid'.
57+
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?journal=invalid'. Unsupported value for "journal": "invalid".
5858
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
5959
Expected boolean for "journal" URI option, string given
6060
OK: Got MongoDB\Driver\Exception\InvalidArgumentException

tests/manager/manager-ctor-write_concern-error-006.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ echo throws(function() {
2020
<?php exit(0); ?>
2121
--EXPECT--
2222
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
23-
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?safe=invalid'. Unknown option or value for 'safe=invalid'.
23+
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?safe=invalid'. Unsupported value for "safe": "invalid".
2424
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
2525
Expected boolean for "safe" URI option, string given
2626
===DONE===

tests/manager/manager-executeRawCommand-001.phpt renamed to tests/manager/manager-executeCommand-004.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
MongoDB\Driver\Manager::executeRawCommand()
2+
MongoDB\Driver\Manager::executeCommand() options (MONGOC_CMD_RAW)
33
--SKIPIF--
44
<?php if (getenv("TRAVIS")) exit("skip This currently tails on Travis because it doesn't run 3.6 yet"); ?>
55
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>

tests/manager/manager-executeCommand_error-002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
MongoDB\Driver\Manager::executeCommand(): wrong options and values
2+
MongoDB\Driver\Manager::executeCommand(): wrong options and values (MONGOC_CMD_RAW)
33
--SKIPIF--
44
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
55
<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET); ?>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
--TEST--
2+
MongoDB\Driver\Server::executeCommand() options (MONGO_CMD_RAW)
3+
--SKIPIF--
4+
<?php if (getenv("TRAVIS")) exit("skip This currently tails on Travis because it doesn't run 3.6 yet"); ?>
5+
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
6+
<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
7+
--FILE--
8+
<?php
9+
require_once __DIR__ . "/../utils/basic.inc";
10+
require_once __DIR__ . "/../utils/observer.php";
11+
12+
$manager = new MongoDB\Driver\Manager(STANDALONE);
13+
$server = $manager->selectServer(new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY));
14+
15+
(new CommandObserver)->observe(
16+
function() use ($server) {
17+
$command = new MongoDB\Driver\Command([
18+
'ping' => true,
19+
]);
20+
21+
try {
22+
$server->executeCommand(
23+
DATABASE_NAME,
24+
$command,
25+
[
26+
'readPreference' => new \MongoDB\Driver\ReadPreference(\MongoDB\Driver\ReadPreference::RP_SECONDARY),
27+
'readConcern' => new \MongoDB\Driver\ReadConcern(\MongoDB\Driver\ReadConcern::LOCAL),
28+
'writeConcern' => new \MongoDB\Driver\WriteConcern(\MongoDB\Driver\WriteConcern::MAJORITY),
29+
]
30+
);
31+
} catch ( Exception $e ) {
32+
// Ignore exception that ping doesn't support writeConcern
33+
}
34+
},
35+
function(stdClass $command) {
36+
echo "Read Preference: ", $command->{'$readPreference'}->mode, "\n";
37+
echo "Read Concern: ", $command->readConcern->level, "\n";
38+
echo "Write Concern: ", $command->writeConcern->w, "\n";
39+
}
40+
);
41+
42+
?>
43+
===DONE===
44+
<?php exit(0); ?>
45+
--EXPECTF--
46+
Read Preference: secondary
47+
Read Concern: local
48+
Write Concern: majority
49+
===DONE===

tests/server/server-executeCommand_error-001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
MongoDB\Driver\Server::executeCommand(): wrong options and values
2+
MongoDB\Driver\Server::executeCommand(): wrong options and values (MONGOC_CMD_RAW)
33
--SKIPIF--
44
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
55
<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET); ?>

0 commit comments

Comments
 (0)