-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
112 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--TEST-- | ||
MongoDB\Driver\Manager::__construct(): authentication options are validated | ||
--FILE-- | ||
<?php | ||
|
||
require_once __DIR__ . '/../utils/tools.php'; | ||
|
||
echo throws(function() { | ||
new MongoDB\Driver\Manager('mongodb://localhost:27017/?authMechanism=GSSAPI&authSource=admin'); | ||
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n"; | ||
|
||
echo throws(function() { | ||
new MongoDB\Driver\Manager('mongodb://localhost:27017/', ['authMechanism' => 'GSSAPI', 'authSource' => 'admin']); | ||
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n"; | ||
|
||
echo throws(function() { | ||
new MongoDB\Driver\Manager('mongodb://localhost:27017/?authMechanism=MONGODB-X509&authSource=admin'); | ||
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n"; | ||
|
||
echo throws(function() { | ||
new MongoDB\Driver\Manager('mongodb://localhost:27017/', ['authMechanism' => 'MONGODB-X509', 'authSource' => 'admin']); | ||
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n"; | ||
|
||
echo throws(function() { | ||
new MongoDB\Driver\Manager('mongodb://@localhost:27017/?authMechanism=SCRAM-SHA-1'); | ||
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n"; | ||
|
||
echo throws(function() { | ||
new MongoDB\Driver\Manager('mongodb://localhost:27017/', ['username' => '', 'authMechanism' => 'SCRAM-SHA-1']); | ||
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n"; | ||
|
||
echo throws(function() { | ||
new MongoDB\Driver\Manager('mongodb://localhost:27017/', ['password' => 'password', 'authMechanism' => 'MONGODB-X509']); | ||
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n"; | ||
|
||
?> | ||
===DONE=== | ||
<?php exit(0); ?> | ||
--EXPECT-- | ||
OK: Got MongoDB\Driver\Exception\InvalidArgumentException | ||
Failed to parse MongoDB URI: 'mongodb://localhost:27017/?authMechanism=GSSAPI&authSource=admin'. GSSAPI and X509 require "$external" authSource. | ||
OK: Got MongoDB\Driver\Exception\InvalidArgumentException | ||
Failed to parse URI options: GSSAPI and X509 require "$external" authSource. | ||
OK: Got MongoDB\Driver\Exception\InvalidArgumentException | ||
Failed to parse MongoDB URI: 'mongodb://localhost:27017/?authMechanism=MONGODB-X509&authSource=admin'. GSSAPI and X509 require "$external" authSource. | ||
OK: Got MongoDB\Driver\Exception\InvalidArgumentException | ||
Failed to parse URI options: GSSAPI and X509 require "$external" authSource. | ||
OK: Got MongoDB\Driver\Exception\InvalidArgumentException | ||
Failed to parse MongoDB URI: 'mongodb://@localhost:27017/?authMechanism=SCRAM-SHA-1'. 'SCRAM-SHA-1' authentication mechanism requires username. | ||
OK: Got MongoDB\Driver\Exception\InvalidArgumentException | ||
Failed to parse URI options: 'SCRAM-SHA-1' authentication mechanism requires username. | ||
OK: Got MongoDB\Driver\Exception\InvalidArgumentException | ||
Failed to parse URI options: X509 authentication mechanism does not accept a password. | ||
===DONE=== |