xref: /php-src/ext/date/tests/014.phpt (revision fbe30592)
1--TEST--
2timezone_offset_get() tests
3--FILE--
4<?php
5date_default_timezone_set('UTC');
6
7$dto = date_create("2006-12-12");
8var_dump($dto);
9
10$dtz = date_timezone_get($dto);
11var_dump($dtz);
12
13var_dump(timezone_offset_get($dtz, $dto));
14var_dump(timezone_offset_get($dto, $dtz));
15
16echo "Done\n";
17
18?>
19--EXPECTF--
20object(DateTime)#%d (3) {
21  ["date"]=>
22  string(26) "2006-12-12 00:00:00.000000"
23  ["timezone_type"]=>
24  int(3)
25  ["timezone"]=>
26  string(3) "UTC"
27}
28object(DateTimeZone)#%d (2) {
29  ["timezone_type"]=>
30  int(3)
31  ["timezone"]=>
32  string(3) "UTC"
33}
34int(0)
35
36Fatal error: Uncaught TypeError: timezone_offset_get(): Argument #1 ($object) must be of type DateTimeZone, DateTime given in %s:%d
37Stack trace:
38#0 %s(%d): timezone_offset_get(Object(DateTime), Object(DateTimeZone))
39#1 {main}
40  thrown in %s on line %d
41