1--TEST--
2IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() for ICU >= 58.1 and < 70.1
3--EXTENSIONS--
4intl
5--SKIPIF--
6<?php
7if (version_compare(INTL_ICU_VERSION, '58.1') < 0 || version_compare(INTL_ICU_VERSION, '70.1') >= 0) die('skip for ICU >= 58.1 and < 70.1');
8?>
9--FILE--
10<?php
11ini_set("intl.error_level", E_WARNING);
12ini_set("intl.default_locale", "pt_PT");
13ini_set("date.timezone", 'Atlantic/Azores');
14
15$ts = strtotime('2012-01-01 00:00:00 UTC');
16
17function d(IntlDateFormatter $df) {
18global $ts;
19echo $df->format($ts), "\n";
20var_dump($df->getCalendar(),
21$df->getCalendarObject()->getType(),
22$df->getCalendarObject()->getTimeZone()->getId());
23echo "\n";
24}
25
26$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk');
27d($df);
28
29
30//changing the calendar with a cal type should not change tz
31$df->setCalendar(IntlDateFormatter::TRADITIONAL);
32d($df);
33
34//but changing with an actual calendar should
35$cal = IntlCalendar::createInstance("UTC");
36$df->setCalendar($cal);
37d($df);
38
39?>
40--EXPECT--
41dimanche 1 janvier 2012 ap. J.-C. à 03:00:00 heure de Kaliningrad
42int(1)
43string(9) "gregorian"
44string(12) "Europe/Minsk"
45
46dimanche 8 safar 1433 AH à 03:00:00 heure de Kaliningrad
47int(0)
48string(7) "islamic"
49string(12) "Europe/Minsk"
50
51dimanche 1 janvier 2012 ap. J.-C. à 00:00:00 Temps universel coordonné
52bool(false)
53string(9) "gregorian"
54string(3) "UTC"
55
56