|
| 1 | +--TEST-- |
| 2 | +BSON BSON\Timestamp constructor requires positive unsigned 32-bit integers |
| 3 | +--SKIPIF-- |
| 4 | +<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?> |
| 5 | +--FILE-- |
| 6 | +<?php |
| 7 | +require_once __DIR__ . "/../utils/basic.inc"; |
| 8 | + |
| 9 | +use MongoDB\BSON as BSON; |
| 10 | + |
| 11 | +echo throws(function() { |
| 12 | + new BSON\Timestamp(-1, 0); |
| 13 | +}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; |
| 14 | + |
| 15 | +echo throws(function() { |
| 16 | + new BSON\Timestamp(-2147483648, 0); |
| 17 | +}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; |
| 18 | + |
| 19 | +echo throws(function() { |
| 20 | + new BSON\Timestamp(0, -1); |
| 21 | +}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; |
| 22 | + |
| 23 | +echo throws(function() { |
| 24 | + new BSON\Timestamp(0, -2147483648); |
| 25 | +}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; |
| 26 | + |
| 27 | +?> |
| 28 | +===DONE=== |
| 29 | +<?php exit(0); ?> |
| 30 | +--EXPECT-- |
| 31 | +OK: Got MongoDB\Driver\Exception\InvalidArgumentException |
| 32 | +Expected increment to be an unsigned 32-bit integer, -1 given |
| 33 | +OK: Got MongoDB\Driver\Exception\InvalidArgumentException |
| 34 | +Expected increment to be an unsigned 32-bit integer, -2147483648 given |
| 35 | +OK: Got MongoDB\Driver\Exception\InvalidArgumentException |
| 36 | +Expected timestamp to be an unsigned 32-bit integer, -1 given |
| 37 | +OK: Got MongoDB\Driver\Exception\InvalidArgumentException |
| 38 | +Expected timestamp to be an unsigned 32-bit integer, -2147483648 given |
| 39 | +===DONE=== |
0 commit comments