Skip to content

Commit 4c5f9a6

Browse files
committed
PHPC-934: Fixed tests for MongoDB 3.6
1 parent fa851df commit 4c5f9a6

7 files changed

+16
-33
lines changed

tests/manager/manager-executeCommand_error-002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ Expected 'readPreference' option to be 'MongoDB\Driver\ReadPreference', object g
3636
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
3737
Unknown option 'unknown'
3838
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
39-
Unknown option 'writeConcern'
39+
Expected 'writeConcern' option to be 'MongoDB\Driver\WriteConcern', string given
4040
===DONE===

tests/server/server-executeBulkWrite-004.phpt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ require_once __DIR__ . "/../utils/basic.inc";
1010
$manager = new MongoDB\Driver\Manager(REPLICASET);
1111
$server = $manager->selectServer(new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY));
1212

13-
$bulk = new MongoDB\Driver\BulkWrite();
14-
$bulk->insert(array('wc' => 0));
15-
16-
$result = $server->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(0));
17-
var_dump($result->isAcknowledged());
18-
var_dump($result->getInsertedCount());
19-
2013
$writeConcerns = array(1, 2, MongoDB\Driver\WriteConcern::MAJORITY);
2114

2215
foreach ($writeConcerns as $wc) {
@@ -32,8 +25,6 @@ foreach ($writeConcerns as $wc) {
3225
===DONE===
3326
<?php exit(0); ?>
3427
--EXPECT--
35-
bool(false)
36-
NULL
3728
OK: Got MongoDB\Driver\Exception\RuntimeException
3829
not master
3930
OK: Got MongoDB\Driver\Exception\RuntimeException

tests/server/server-executeBulkWrite-007.phpt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ require_once __DIR__ . "/../utils/basic.inc";
1010
$manager = new MongoDB\Driver\Manager(REPLICASET);
1111
$server = $manager->selectServer(new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY));
1212

13-
$bulk = new MongoDB\Driver\BulkWrite();
14-
$bulk->insert(['wc' => 0]);
15-
16-
$result = $server->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(0));
17-
var_dump($result->isAcknowledged());
18-
var_dump($result->getInsertedCount());
19-
2013
$writeConcerns = [1, 2, MongoDB\Driver\WriteConcern::MAJORITY];
2114

2215
foreach ($writeConcerns as $wc) {
@@ -36,8 +29,6 @@ foreach ($writeConcerns as $wc) {
3629
===DONE===
3730
<?php exit(0); ?>
3831
--EXPECT--
39-
bool(false)
40-
NULL
4132
OK: Got MongoDB\Driver\Exception\RuntimeException
4233
not master
4334
OK: Got MongoDB\Driver\Exception\RuntimeException

tests/server/server-executeCommand-002.phpt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ $result = current($cursor->toArray());
1818

1919
printf("Set profile level to 2 successfully: %s\n", (empty($result->ok) ? 'no' : 'yes'));
2020

21-
$command = new MongoDB\Driver\Command(array(
21+
$command = new MongoDB\Driver\Command([
2222
'aggregate' => COLLECTION_NAME,
23-
'pipeline' => array(array('$match' => array('x' => 1))),
24-
));
23+
'pipeline' => [ [ '$match' => [ 'x' => 1 ] ] ],
24+
'cursor' => (object) [],
25+
]);
2526
$secondary->executeCommand(DATABASE_NAME, $command, $rp);
2627

2728
$query = new MongoDB\Driver\Query(
@@ -64,6 +65,9 @@ object(stdClass)#%d (%d) {
6465
}
6566
}
6667
}
68+
["cursor"]=>
69+
object(stdClass)#16 (0) {
70+
}%A
6771
}
6872
Set profile level to 0 successfully: yes
6973
===DONE===

tests/server/server-executeCommand-003.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ array(1) {
2828
[0]=>
2929
object(stdClass)#%d (%d) {
3030
["ok"]=>
31-
float(1)
31+
float(1)%A
3232
}
3333
}
3434
===DONE===

tests/server/server-executeCommand_error-001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ Expected 'readPreference' option to be 'MongoDB\Driver\ReadPreference', object g
3838
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
3939
Unknown option 'unknown'
4040
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
41-
Unknown option 'writeConcern'
41+
Expected 'writeConcern' option to be 'MongoDB\Driver\WriteConcern', string given
4242
===DONE===

tests/server/server-executeQuery-006.phpt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ $query = new MongoDB\Driver\Query(
3737
$cursor = $secondary->executeQuery(DATABASE_NAME . '.system.profile', $query, $rp);
3838
$profileEntry = current($cursor->toArray());
3939

40-
var_dump($profileEntry->query);
40+
var_dump($profileEntry->command->find);
41+
var_dump($profileEntry->command->filter);
4142

4243
$command = new MongoDB\Driver\Command(array('profile' => 0));
4344
$cursor = $secondary->executeCommand(DATABASE_NAME, $command);
@@ -50,14 +51,10 @@ printf("Set profile level to 0 successfully: %s\n", (empty($result->ok) ? 'no' :
5051
<?php exit(0); ?>
5152
--EXPECTF--
5253
Set profile level to 2 successfully: yes
53-
object(stdClass)#%d (%d) {
54-
["find"]=>
55-
string(%d) "%s"
56-
["filter"]=>
57-
object(stdClass)#%d (1) {
58-
["x"]=>
59-
int(1)
60-
}
54+
string(%d) "%s"
55+
object(stdClass)#%d (1) {
56+
["x"]=>
57+
int(1)
6158
}
6259
Set profile level to 0 successfully: yes
6360
===DONE===

0 commit comments

Comments
 (0)