Skip to content

Commit 3a15035

Browse files
committed
Add test for invalid key later in the array
1 parent 3b83ace commit 3a15035

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/bson/bson-packedarray-fromJSON_error-001.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ echo throws(function() {
1717
MongoDB\BSON\PackedArray::fromJSON('{ "00": "bar", "1": "bar" }');
1818
}, 'MongoDB\Driver\Exception\UnexpectedValueException'), PHP_EOL;
1919

20+
echo throws(function() {
21+
MongoDB\BSON\PackedArray::fromJSON('{ "0": "bar", "foo": "bar" }');
22+
}, 'MongoDB\Driver\Exception\UnexpectedValueException'), PHP_EOL;
23+
2024
?>
2125
===DONE===
2226
<?php exit(0); ?>
@@ -27,4 +31,6 @@ OK: Got MongoDB\Driver\Exception\UnexpectedValueException
2731
Received invalid JSON array: expected key 0, but found "foo"
2832
OK: Got MongoDB\Driver\Exception\UnexpectedValueException
2933
Received invalid JSON array: expected key 0, but found "00"
34+
OK: Got MongoDB\Driver\Exception\UnexpectedValueException
35+
Received invalid JSON array: expected key 1, but found "foo"
3036
===DONE===

0 commit comments

Comments
 (0)