Skip to content

Commit 7a79f14

Browse files
committed
Regression test for out of range maxStalenessSeconds option in URI string
1 parent 3b171c7 commit 7a79f14

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ echo throws(function() {
1313
$manager = new MongoDB\Driver\Manager('mongodb://127.0.0.1/?maxStalenessSeconds=1231');
1414
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
1515

16+
echo throws(function() {
17+
$manager = new MongoDB\Driver\Manager('mongodb://127.0.0.1/?readPreference=secondary&maxStalenessSeconds=2147483648');
18+
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
19+
1620
echo throws(function() {
1721
$manager = new MongoDB\Driver\Manager(null, ['maxstalenessseconds' => 1231]);
1822
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
@@ -42,6 +46,8 @@ Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?maxstalenessseconds=1231'. In
4246
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
4347
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?maxStalenessSeconds=1231'. Invalid readPreferences.
4448
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
49+
Failed to parse MongoDB URI: 'mongodb://127.0.0.1/?readPreference=secondary&maxStalenessSeconds=2147483648'. Unknown option or value for 'maxStalenessSeconds=2147483648'.
50+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
4551
Primary read preference mode conflicts with maxStalenessSeconds
4652
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
4753
Primary read preference mode conflicts with maxStalenessSeconds

0 commit comments

Comments
 (0)