1--TEST--
2MongoDB\Driver\BulkWrite::update() with invalid options
3--FILE--
4<?php
5
6require_once __DIR__ . '/../utils/tools.php';
7
8$bulk = new MongoDB\Driver\BulkWrite;
9
10echo throws(function() use ($bulk) {
11    $bulk->update(['x' => 1], ['y' => 1], ['multi' => true]);
12}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n";
13
14echo throws(function() use ($bulk) {
15    $bulk->update(['x' => 1], ['y' => 1], ['collation' => 1]);
16}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n";
17
18echo throws(function() use ($bulk) {
19    $bulk->update(['x' => 1], ['$set' => ['y' => 1]], ['collation' => 1]);
20}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n";
21
22echo throws(function() use ($bulk) {
23    $bulk->update(['x' => 1], ['$set' => ['y' => 1]], ['arrayFilters' => 1]);
24}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n";
25
26echo throws(function() use ($bulk) {
27    $bulk->update(['x' => 1], ['$set' => ['y' => 1]], ['arrayFilters' => ['foo' => 'bar']]);
28}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n";
29
30echo throws(function() use ($bulk) {
31    $bulk->update(['x' => 1], ['$set' => ['y' => 1]], ['hint' => 1]);
32}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
33
34?>
35===DONE===
36<?php exit(0); ?>
37--EXPECTF--
38OK: Got MongoDB\Driver\Exception\InvalidArgumentException
39Replacement document conflicts with true "multi" option
40
41OK: Got MongoDB\Driver\Exception\InvalidArgumentException
42Expected "collation" option to be array or object, int%S given
43
44OK: Got MongoDB\Driver\Exception\InvalidArgumentException
45Expected "collation" option to be array or object, int%S given
46
47OK: Got MongoDB\Driver\Exception\InvalidArgumentException
48Expected "arrayFilters" option to be array or object, int%S given
49
50OK: Got MongoDB\Driver\Exception\InvalidArgumentException
51"arrayFilters" option has invalid keys for a BSON array
52
53OK: Got MongoDB\Driver\Exception\InvalidArgumentException
54Expected "hint" option to be string, array, or object, int%S given
55===DONE===
56