Skip to content

Commit 095f93d

Browse files
committed
Merge pull request #988
2 parents c3be2cd + 75080c3 commit 095f93d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tests/standalone/connectiontimeoutexception-001.phpt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@ ConnectionTimeoutException: exceeding sockettimeoutms
33
--SKIPIF--
44
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
55
<?php skip_if_not_live(); ?>
6-
<?php skip_if_not_clean(); ?>
76
<?php skip_if_test_commands_disabled(); ?>
87
<?php skip_if_sleep_command_unavailable(); ?>
98
--FILE--
109
<?php
1110
require_once __DIR__ . "/" . "../utils/basic.inc";
1211

13-
$uri = append_uri_option(URI, 'sockettimeoutms=9');
12+
/* A 500ms socket timeout will ensure that SDAM and any authentication can
13+
* complete before executing a sleep command to trigger a network error. */
14+
$uri = append_uri_option(URI, 'sockettimeoutms=500');
1415
$manager = new MongoDB\Driver\Manager($uri);
1516

16-
$cmd = array(
17-
"sleep" => 1,
18-
"w" => false,
19-
"secs" => 2,
20-
);
21-
$command = new MongoDB\Driver\Command($cmd);
17+
$command = new MongoDB\Driver\Command([
18+
'sleep' => 1,
19+
'secs' => 1,
20+
'w' => false,
21+
]);
2222

23-
throws(function() use ($manager, $command) {
24-
$result = $manager->executeCommand("admin", $command);
25-
var_dump($result->toArray());
26-
}, "MongoDB\Driver\Exception\\ConnectionTimeoutException");
23+
echo throws(function() use ($manager, $command) {
24+
$manager->executeCommand('admin', $command);
25+
}, 'MongoDB\Driver\Exception\\ConnectionTimeoutException'), "\n";
2726

2827
?>
2928
===DONE===
3029
<?php exit(0); ?>
3130
--EXPECT--
3231
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
32+
Failed to send "sleep" command with database "admin": Failed to read 4 bytes: socket error or timeout
3333
===DONE===

0 commit comments

Comments
 (0)