Skip to content

Commit 31dcb61

Browse files
committed
PHPC-1950: Update authMechanism URI option tests
Now that URI option validation is consistent between connection strings and array options, we can remove the previous test for authSource without credentials.
1 parent f74a609 commit 31dcb61

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

tests/connect/bug1045.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ echo throws(function() {
1818
<?php exit(0); ?>
1919
--EXPECTF--
2020
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
21-
Failed to parse URI options: 'SCRAM-SHA-1' authentication mechanism requires username.
21+
Failed to parse URI options: 'SCRAM-SHA-1' authentication mechanism requires username
2222
===DONE===

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,22 @@ echo throws(function() {
3333
create_test_manager('mongodb://localhost:27017/', ['password' => 'password', 'authMechanism' => 'MONGODB-X509']);
3434
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
3535

36-
// TODO: This test case should be removed by PHPC-1950
37-
echo throws(function() {
38-
create_test_manager('mongodb://localhost:27017/', ['authSource' => 'foo']);
39-
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
40-
4136
?>
4237
===DONE===
4338
<?php exit(0); ?>
4439
--EXPECT--
4540
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
4641
Failed to parse MongoDB URI: 'mongodb://localhost:27017/?authMechanism=GSSAPI&authSource=admin'. GSSAPI and X509 require "$external" authSource.
4742
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
48-
Failed to parse URI options: GSSAPI and X509 require "$external" authSource.
43+
Failed to parse URI options: GSSAPI and X509 require "$external" authSource
4944
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
5045
Failed to parse MongoDB URI: 'mongodb://localhost:27017/?authMechanism=MONGODB-X509&authSource=admin'. GSSAPI and X509 require "$external" authSource.
5146
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
52-
Failed to parse URI options: GSSAPI and X509 require "$external" authSource.
47+
Failed to parse URI options: GSSAPI and X509 require "$external" authSource
5348
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
5449
Failed to parse MongoDB URI: 'mongodb://@localhost:27017/?authMechanism=SCRAM-SHA-1'. 'SCRAM-SHA-1' authentication mechanism requires username.
5550
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
56-
Failed to parse URI options: 'SCRAM-SHA-1' authentication mechanism requires username.
57-
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
58-
Failed to parse URI options: X509 authentication mechanism does not accept a password.
51+
Failed to parse URI options: 'SCRAM-SHA-1' authentication mechanism requires username
5952
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
60-
Failed to parse URI options: Default authentication mechanism requires username.
53+
Failed to parse URI options: 'MONGODB-X509' authentication mechanism does not accept a password
6154
===DONE===

0 commit comments

Comments
 (0)