Skip to content

Commit b3df6bb

Browse files
committed
test update
1 parent 303b4cc commit b3df6bb

1 file changed

Lines changed: 33 additions & 8 deletions

File tree

ext/date/tests/gh20764.phpt

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,51 @@ GH-20764 (Timezone offset with seconds loses precision)
33
--FILE--
44
<?php
55

6-
$tz = new DateTimeZone('+03:00:30');
7-
$dt = new DateTimeImmutable('2025-04-01', $tz);
8-
var_dump($dt->format('e'));
9-
var_dump($dt);
10-
var_dump(unserialize(serialize($dt))->getTimezone());
6+
$timezones = [
7+
'+03:00:30',
8+
'-03:00:30',
9+
];
10+
11+
foreach ($timezones as $timezone) {
12+
echo "--- Testing timezone $timezone ---\n";
13+
$tz = new DateTimeZone($timezone);
14+
$dt = new DateTimeImmutable('2025-04-01', $tz);
15+
var_dump($dt->format('e'));
16+
var_dump($dt);
17+
var_dump(unserialize(serialize($dt))->getTimezone());
18+
}
1119

1220
?>
13-
--EXPECT--
21+
--EXPECTF--
22+
--- Testing timezone +03:00:30 ---
1423
string(9) "+03:00:30"
15-
object(DateTimeImmutable)#2 (3) {
24+
object(DateTimeImmutable)#%d (3) {
1625
["date"]=>
1726
string(26) "2025-04-01 00:00:00.000000"
1827
["timezone_type"]=>
1928
int(1)
2029
["timezone"]=>
2130
string(9) "+03:00:30"
2231
}
23-
object(DateTimeZone)#4 (2) {
32+
object(DateTimeZone)#%d (2) {
2433
["timezone_type"]=>
2534
int(1)
2635
["timezone"]=>
2736
string(9) "+03:00:30"
2837
}
38+
--- Testing timezone -03:00:30 ---
39+
string(9) "-03:00:30"
40+
object(DateTimeImmutable)#%d (3) {
41+
["date"]=>
42+
string(26) "2025-04-01 00:00:00.000000"
43+
["timezone_type"]=>
44+
int(1)
45+
["timezone"]=>
46+
string(9) "-03:00:30"
47+
}
48+
object(DateTimeZone)#%d (2) {
49+
["timezone_type"]=>
50+
int(1)
51+
["timezone"]=>
52+
string(9) "-03:00:30"
53+
}

0 commit comments

Comments
 (0)