forked from mongodb/mongo-php-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbulkwritecommand-deleteOne_error-003.phpt
55 lines (41 loc) · 1.93 KB
/
bulkwritecommand-deleteOne_error-003.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--TEST--
MongoDB\Driver\BulkWriteCommand::deleteOne() with BSON encoding error (null bytes in keys)
--FILE--
<?php
require_once __DIR__ . '/../utils/basic.inc';
$bulk = new MongoDB\Driver\BulkWriteCommand;
echo throws(function() use ($bulk) {
$bulk->deleteOne(NS, ["\0" => 1]);
}, 'MongoDB\Driver\Exception\UnexpectedValueException'), "\n\n";
echo throws(function() use ($bulk) {
$bulk->deleteOne(NS, ["x\0" => 1]);
}, 'MongoDB\Driver\Exception\UnexpectedValueException'), "\n\n";
echo throws(function() use ($bulk) {
$bulk->deleteOne(NS, ["\0\0\0" => 1]);
}, 'MongoDB\Driver\Exception\UnexpectedValueException'), "\n\n";
echo throws(function() use ($bulk) {
$bulk->deleteOne(NS, ['x' => 1], ['collation' => ["\0" => 1]]);
}, 'MongoDB\Driver\Exception\UnexpectedValueException'), "\n\n";
echo throws(function() use ($bulk) {
$bulk->deleteOne(NS, ['x' => 1], ['collation' => ["x\0" => 1]]);
}, 'MongoDB\Driver\Exception\UnexpectedValueException'), "\n\n";
echo throws(function() use ($bulk) {
$bulk->deleteOne(NS, ['x' => 1], ['collation' => ["\0\0\0" => 1]]);
}, 'MongoDB\Driver\Exception\UnexpectedValueException'), "\n";
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
OK: Got MongoDB\Driver\Exception\UnexpectedValueException
BSON keys cannot contain null bytes. Unexpected null byte after "".
OK: Got MongoDB\Driver\Exception\UnexpectedValueException
BSON keys cannot contain null bytes. Unexpected null byte after "x".
OK: Got MongoDB\Driver\Exception\UnexpectedValueException
BSON keys cannot contain null bytes. Unexpected null byte after "".
OK: Got MongoDB\Driver\Exception\UnexpectedValueException
BSON keys cannot contain null bytes. Unexpected null byte after "".
OK: Got MongoDB\Driver\Exception\UnexpectedValueException
BSON keys cannot contain null bytes. Unexpected null byte after "x".
OK: Got MongoDB\Driver\Exception\UnexpectedValueException
BSON keys cannot contain null bytes. Unexpected null byte after "".
===DONE===