Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
opt
/
php-8.2.24-202410171016
/
share
/
test
/
mongodb
/
tests
/
bson
/
//opt/php-8.2.24-202410171016/share/test/mongodb/tests/bson/bson-utcdatetime_error-004.phpt
--TEST-- MongoDB\BSON\UTCDateTime constructor requires integer or string argument --FILE-- <?php require_once __DIR__ . '/../utils/basic.inc'; /* UTCDateTime::__construct() internally converts floats to integers, so we will * not use a float to test for an invalid value. We also don't test an object, * since that is used for validating a possible DateTimeInterface argument. */ $invalidValues = [true, []]; foreach ($invalidValues as $invalidValue) { echo throws(function() use ($invalidValue) { new MongoDB\BSON\UTCDateTime($invalidValue); }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; } ?> ===DONE=== <?php exit(0); ?> --EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected integer or string, bool given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected integer or string, array given ===DONE===