Skip to content

Commit f74a609

Browse files
committed
PHPC-1900: Test srvServiceName URI option
1 parent 963d720 commit f74a609

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
MongoDB\Driver\Manager::__construct(): srvServiceName option validation
3+
--FILE--
4+
<?php
5+
6+
require_once __DIR__ . '/../utils/basic.inc';
7+
8+
echo throws(function() {
9+
create_test_manager('mongodb://localhost:27017/?srvServiceName=foo');
10+
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
11+
12+
echo throws(function() {
13+
create_test_manager('mongodb://localhost:27017', ['srvServiceName' => 'foo']);
14+
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
15+
16+
?>
17+
===DONE===
18+
<?php exit(0); ?>
19+
--EXPECT--
20+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
21+
Failed to parse MongoDB URI: 'mongodb://localhost:27017/?srvServiceName=foo'. srvservicename must not be specified with a non-SRV URI.
22+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
23+
Failed to parse URI options: srvservicename must not be specified with a non-SRV URI
24+
===DONE===

0 commit comments

Comments
 (0)