Skip to content

Commit 2dce588

Browse files
committed
PHP-1181: Improve coverage for BSON\UTCDateTime
1 parent f72261a commit 2dce588

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/bson/bson-utcdatetime-001.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ $array = iterator_to_array($cursor);
1818
$date = $utcdatetime->toDateTime();
1919
var_dump($date->format(DATE_RSS));
2020

21+
throws(function() use ($utcdatetime) {
22+
echo $utcdatetime, "\n";
23+
$utcdatetime->__toString(1);
24+
}, "InvalidArgumentException");
25+
26+
throws(function() use ($utcdatetime) {
27+
$utcdatetime->toDateTime(DATE_RSS);
28+
}, "InvalidArgumentException");
29+
30+
throws(function() {
31+
$d = new BSON\UTCDatetime;
32+
}, "InvalidArgumentException");
2133

2234
$tests = array(
2335
array($utcdatetime),
@@ -38,6 +50,10 @@ foreach($tests as $n => $test) {
3850
<?php exit(0); ?>
3951
--EXPECTF--
4052
string(31) "Thu, 20 Nov 2014 01:03:31 +0000"
53+
1416445411987
54+
OK: Got InvalidArgumentException
55+
OK: Got InvalidArgumentException
56+
OK: Got InvalidArgumentException
4157
Test#0 { "0" : { "$date" : 1416445411987 } }
4258
string(37) "{ "0" : { "$date" : 1416445411987 } }"
4359
string(37) "{ "0" : { "$date" : 1416445411987 } }"

0 commit comments

Comments
 (0)