diff --git a/tests/bson/bson-utcdatetime-008.phpt b/tests/bson/bson-utcdatetime-008.phpt deleted file mode 100644 index e8a9bb10..00000000 --- a/tests/bson/bson-utcdatetime-008.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -MongoDB\BSON\UTCDateTime construction from 64-bit integer as string ---FILE-- - new MongoDB\BSON\UTCDateTime('1416445411987'), MongoDB\Driver\Exception\InvalidArgumentException::class), PHP_EOL; - -?> -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected integer or object, string given -===DONE=== diff --git a/tests/bson/bson-utcdatetime_error-003.phpt b/tests/bson/bson-utcdatetime_error-003.phpt deleted file mode 100644 index 3b5afdcf..00000000 --- a/tests/bson/bson-utcdatetime_error-003.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -MongoDB\BSON\UTCDateTime constructor requires strings to parse as 64-bit integers ---FILE-- - -===DONE=== - ---EXPECT-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected integer or object, string given -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected integer or object, string given -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected integer or object, string given -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected integer or object, string given -===DONE=== diff --git a/tests/bson/bson-utcdatetime_error-004.phpt b/tests/bson/bson-utcdatetime_error-004.phpt index e4d123a4..9e879805 100644 --- a/tests/bson/bson-utcdatetime_error-004.phpt +++ b/tests/bson/bson-utcdatetime_error-004.phpt @@ -8,12 +8,19 @@ 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, []]; +$invalidValues = [ + true, + [], + // Numeric strings are no longer supported as of 2.0 + '1416445411987', + '1234.5678', +]; foreach ($invalidValues as $invalidValue) { - echo throws(function() use ($invalidValue) { - new MongoDB\BSON\UTCDateTime($invalidValue); - }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; + echo throws( + fn () => new MongoDB\BSON\UTCDateTime($invalidValue), + MongoDB\Driver\Exception\InvalidArgumentException::class, + ), PHP_EOL; } ?> @@ -24,4 +31,8 @@ OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected integer or object, bool given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected integer or object, array given +OK: Got MongoDB\Driver\Exception\InvalidArgumentException +Expected integer or object, string given +OK: Got MongoDB\Driver\Exception\InvalidArgumentException +Expected integer or object, string given ===DONE===