Skip to content

Commit 59b0751

Browse files
committed
Split UTCDateTime integer parsing test for 64-bit requirement
1 parent fa5815e commit 59b0751

File tree

2 files changed

+38
-20
lines changed

2 files changed

+38
-20
lines changed
Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Test for UTCDateTime and integer parsing
2+
MongoDB\BSON\UTCDateTime integer parsing from string
33
--SKIPIF--
44
<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM implements only an older version of DateTime"); ?>
55
--INI--
@@ -8,31 +8,15 @@ error_reporting=-1
88
dislay_errors=1
99
--FILE--
1010
<?php
11-
echo "As number:\n";
12-
$utcdatetime = new MongoDB\BSON\UTCDateTime(1416445411987);
13-
var_dump($utcdatetime);
14-
var_dump($utcdatetime->toDateTime());
1511

16-
echo "As string:\n";
1712
$utcdatetime = new MongoDB\BSON\UTCDateTime('1416445411987');
1813
var_dump($utcdatetime);
1914
var_dump($utcdatetime->toDateTime());
15+
2016
?>
17+
===DONE===
18+
<?php exit(0); ?>
2119
--EXPECTF--
22-
As number:
23-
object(MongoDB\BSON\UTCDateTime)#%d (1) {
24-
["milliseconds"]=>
25-
%r(string\(13\) "|int\()%r1416445411987%r("|\))%r
26-
}
27-
object(DateTime)#%d (3) {
28-
["date"]=>
29-
string(26) "2014-11-20 01:03:31.987000"
30-
["timezone_type"]=>
31-
int(1)
32-
["timezone"]=>
33-
string(6) "+00:00"
34-
}
35-
As string:
3620
object(MongoDB\BSON\UTCDateTime)#%d (1) {
3721
["milliseconds"]=>
3822
%r(string\(13\) "|int\()%r1416445411987%r("|\))%r
@@ -45,3 +29,4 @@ object(DateTime)#%d (3) {
4529
["timezone"]=>
4630
string(6) "+00:00"
4731
}
32+
===DONE===
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--TEST--
2+
MongoDB\BSON\UTCDateTime integer parsing from number (64-bit)
3+
--SKIPIF--
4+
<?php if (8 !== PHP_INT_SIZE) { die('skip Only for 64-bit platform'); } ?>
5+
<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM implements only an older version of DateTime"); ?>
6+
--INI--
7+
date.timezone=UTC
8+
error_reporting=-1
9+
dislay_errors=1
10+
--FILE--
11+
<?php
12+
13+
$utcdatetime = new MongoDB\BSON\UTCDateTime(1416445411987);
14+
var_dump($utcdatetime);
15+
var_dump($utcdatetime->toDateTime());
16+
17+
?>
18+
===DONE===
19+
<?php exit(0); ?>
20+
--EXPECTF--
21+
object(MongoDB\BSON\UTCDateTime)#%d (1) {
22+
["milliseconds"]=>
23+
%r(string\(13\) "|int\()%r1416445411987%r("|\))%r
24+
}
25+
object(DateTime)#%d (3) {
26+
["date"]=>
27+
string(26) "2014-11-20 01:03:31.987000"
28+
["timezone_type"]=>
29+
int(1)
30+
["timezone"]=>
31+
string(6) "+00:00"
32+
}
33+
===DONE===

0 commit comments

Comments
 (0)