1--TEST--
2IntlDateFormatter: several forms of the calendar arg
3--SKIPIF--
4<?php
5if (!extension_loaded('intl'))	die('skip intl extension not enabled'); ?>
6<?php if (version_compare(INTL_ICU_VERSION, '52.1') < 0) die('skip for ICU >= 52.1'); ?>
7<?php if (version_compare(INTL_ICU_VERSION, '54.1') >=  0) die('skip for ICU < 54.1'); ?>
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
16$cal = new IntlGregorianCalendar('UTC', NULL);
17$df = new IntlDateFormatter('es_ES', 0, 0, NULL, $cal);
18echo $df->format($ts), "\n";
19
20$cal = IntlCalendar::createInstance('UTC', 'en@calendar=islamic');
21$df = new IntlDateFormatter('es_ES', 0, 0, NULL, $cal);
22echo $df->format($ts), "\n";
23
24//override calendar's timezone
25$cal = new IntlGregorianCalendar('UTC', NULL);
26$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Madrid', $cal);
27echo $df->format($ts), "\n";
28
29//default calendar is gregorian
30$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0);
31echo $df->format($ts), "\n";
32
33//try now with traditional
34$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, NULL, IntlDateFormatter::TRADITIONAL);
35echo $df->format($ts), "\n";
36
37//the timezone can be overridden when not specifying a calendar
38$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, 'UTC', IntlDateFormatter::TRADITIONAL);
39echo $df->format($ts), "\n";
40
41$df = new IntlDateFormatter('es_ES', 0, 0, 'UTC', 0);
42echo $df->format($ts), "\n";
43
44?>
45==DONE==
46--EXPECTF--
47domingo%S 1 de enero de 2012, 0:00:00 (GMT)
48domingo%S 8 de Safar de 1433, 0:00:00 (GMT)
49domingo%S 1 de enero de 2012, 1:00:00 (Hora estándar de Europa central)
50sábado%S 31 de diciembre de 2011 d. C., 23:00:00 (Hora estándar %Sde las Azores)
51sábado%S 7 de Safar de 1433 AH, 23:00:00 (Hora estándar %Sde las Azores)
52domingo%S 8 de Safar de 1433 AH, 0:00:00 (GMT)
53domingo%S 1 de enero de 2012, 0:00:00 (GMT)
54==DONE==
55