Viewing File: /opt/alt/tests/alt-php81-pecl-mongodb_1.18.1-1.el8/tests/bson-toPHP_error-003.phpt
--TEST--
MongoDB\BSON\toPHP(): BSON decoding exceptions for malformed documents
--FILE--
<?php
require_once __DIR__ . '/../utils/basic.inc';
$tests = array(
pack('Vx', 4), // Empty document with invalid length (too small)
pack('Vx', 6), // Empty document with invalid length (too large)
);
foreach ($tests as $bson) {
echo throws(function() use ($bson) {
toPHP($bson);
}, 'MongoDB\Driver\Exception\UnexpectedValueException'), "\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
OK: Got MongoDB\Driver\Exception\UnexpectedValueException
Could not read document from BSON reader
OK: Got MongoDB\Driver\Exception\UnexpectedValueException
Could not read document from BSON reader
===DONE===
Back to Directory
File Manager
<