mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-04-01 13:52:11 +02:00
31 lines
920 B
PHP
31 lines
920 B
PHP
--TEST--
|
|
MongoDB\Driver\Manager::executeReadWriteCommand()
|
|
--SKIPIF--
|
|
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
|
|
<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
|
|
--FILE--
|
|
<?php
|
|
require_once __DIR__ . "/../utils/basic.inc";
|
|
|
|
$manager = new MongoDB\Driver\Manager(STANDALONE);
|
|
$server = $manager->selectServer(new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY));
|
|
|
|
$command = new MongoDB\Driver\Command([]);
|
|
|
|
echo throws(function() use ($server, $command) {
|
|
$server->executeReadWriteCommand(
|
|
DATABASE_NAME, $command,
|
|
[
|
|
'readPreference' => new \MongoDB\Driver\ReadPreference(\MongoDB\Driver\ReadPreference::RP_SECONDARY),
|
|
]
|
|
);
|
|
}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
|
|
|
|
?>
|
|
===DONE===
|
|
<?php exit(0); ?>
|
|
--EXPECTF--
|
|
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
|
|
Unknown option 'readPreference'
|
|
===DONE===
|