--TEST-- MongoDB\Driver\Session spec test: session cannot be used for different clients --DESCRIPTION-- Session spec prose test #5: Session argument is for the right client https://github.com/mongodb/specifications/blob/master/source/sessions/tests/README.rst#session-argument-is-for-the-right-client --SKIPIF-- --FILE-- true]); $otherManager = create_test_manager(URI, [], ['disableClientPersistence' => true]); // Create a session with the second Manager (associated with different client) $session = $otherManager->startSession(); echo "\nTesting executeBulkWrite()\n"; echo throws(function() use ($manager, $session) { $bulk = new MongoDB\Driver\BulkWrite(); $bulk->insert(['x' => 1]); $manager->executeBulkWrite(NS, $bulk, ['session' => $session]); }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; echo "\nTesting executeCommand()\n"; echo throws(function() use ($manager, $session) { $command = new MongoDB\Driver\Command(['ping' => 1]); $manager->executeCommand(DATABASE_NAME, $command, ['session' => $session]); }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; echo "\nTesting executeQuery()\n"; echo throws(function() use ($manager, $session) { $query = new MongoDB\Driver\Query([]); $manager->executeQuery(NS, $query, ['session' => $session]); }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; ?> ===DONE=== --EXPECT-- Testing executeBulkWrite() OK: Got MongoDB\Driver\Exception\InvalidArgumentException Cannot use Session started from a different Manager Testing executeCommand() OK: Got MongoDB\Driver\Exception\InvalidArgumentException Cannot use Session started from a different Manager Testing executeQuery() OK: Got MongoDB\Driver\Exception\InvalidArgumentException Cannot use Session started from a different Manager ===DONE===