1--TEST--
2IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() for ICU >= 58.1 and < 70.1
3--SKIPIF--
4<?php
5if (!extension_loaded('intl')) die('skip intl extension not enabled');
6if (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');
7?>
8--FILE--
9<?php
10ini_set("intl.error_level", E_WARNING);
11ini_set("intl.default_locale", "pt_PT");
12ini_set("date.timezone", 'Atlantic/Azores');
13
14$ts = strtotime('2012-01-01 00:00:00 UTC');
15
16function d(IntlDateFormatter $df) {
17global $ts;
18echo $df->format($ts), "\n";
19var_dump($df->getCalendar(),
20$df->getCalendarObject()->getType(),
21$df->getCalendarObject()->getTimeZone()->getId());
22echo "\n";
23}
24
25$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk');
26d($df);
27
28
29//changing the calendar with a cal type should not change tz
30$df->setCalendar(IntlDateFormatter::TRADITIONAL);
31d($df);
32
33//but changing with an actual calendar should
34$cal = IntlCalendar::createInstance("UTC");
35$df->setCalendar($cal);
36d($df);
37
38?>
39==DONE==
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==DONE==
57