Commit: 758f0686d41cd39176f5055c50f0b094580cbbf0
Author: Gustavo André dos Santos Lopes <cataphr...@php.net> Mon, 4
Jun 2012 00:02:35 +0200
Parents: eb346ef0f419b90739aadfb6cc7b7436c5b521d9
Branches: master
Link:
http://git.php.net/?p=php-src.git;a=commitdiff;h=758f0686d41cd39176f5055c50f0b094580cbbf0
Log:
Added and fixed tests given eb346ef
Changed paths:
M ext/intl/tests/bug50590.phpt
M ext/intl/tests/bug62017.phpt
M ext/intl/tests/bug62081.phpt
A ext/intl/tests/dateformat___construct_bad_tz_cal.phpt
M ext/intl/tests/dateformat_calendars.phpt
A ext/intl/tests/dateformat_create_cal_arg.phpt
M ext/intl/tests/dateformat_format.phpt
M ext/intl/tests/dateformat_format_parse.phpt
A ext/intl/tests/dateformat_getCalendarObject_error.phpt
A ext/intl/tests/dateformat_getTimeZone_error.phpt
M ext/intl/tests/dateformat_get_set_calendar.phpt
A ext/intl/tests/dateformat_get_set_timezone.phpt
M ext/intl/tests/dateformat_get_timezone_id.phpt
A ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt
A ext/intl/tests/dateformat_setTimeZone_error.phpt
M ext/intl/tests/dateformat_set_timezone_id2.phpt
A ext/intl/tests/dateformat_timezone_arg_variations.phpt
diff --git a/ext/intl/tests/bug50590.phpt b/ext/intl/tests/bug50590.phpt
index c39c333..4784d37 100644
--- a/ext/intl/tests/bug50590.phpt
+++ b/ext/intl/tests/bug50590.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug #50590 (IntlDateFormatter::parse result is limited to the integer range)
+--INI--
+date.timezone=Atlantic/Azores
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
diff --git a/ext/intl/tests/bug62017.phpt b/ext/intl/tests/bug62017.phpt
index 13c4fe5..50aeae4 100644
--- a/ext/intl/tests/bug62017.phpt
+++ b/ext/intl/tests/bug62017.phpt
@@ -14,7 +14,7 @@ var_dump(
new IntlDateFormatter('', IntlDateFormatter::NONE,
IntlDateFormatter::NONE, "Europe/Lisbon",
IntlDateFormatter::GREGORIAN, "\x80"));
--EXPECTF--
-Warning: datefmt_create(): datefmt_create: error converting timezone_str to
UTF-16 in %s on line %d
+Warning: datefmt_create(): datefmt_create: Time zone identifier given is not a
valid UTF-8 string in %s on line %d
NULL
Warning: IntlDateFormatter::__construct(): datefmt_create: error converting
pattern to UTF-16 in %s on line %d
diff --git a/ext/intl/tests/bug62081.phpt b/ext/intl/tests/bug62081.phpt
index 7d9e2ce..44ad4be 100644
--- a/ext/intl/tests/bug62081.phpt
+++ b/ext/intl/tests/bug62081.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug #62081: IntlDateFormatter leaks memory if called twice
+--INI--
+date.timezone=Atlantic/Azores
--SKIPIF--
<?php
if (!extension_loaded('intl'))
@@ -7,8 +9,8 @@ if (!extension_loaded('intl'))
--FILE--
<?php
ini_set('intl.error_level', E_WARNING);
-$x = new IntlDateFormatter(1,1,1,1,1);
-var_dump($x->__construct(1,1,1,1,1));
+$x = new IntlDateFormatter('en', 1, 1);
+var_dump($x->__construct('en', 1, 1));
--EXPECTF--
Warning: IntlDateFormatter::__construct(): datefmt_create: cannot call
constructor twice in %s on line %d
NULL
diff --git a/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt
b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt
new file mode 100644
index 0000000..1f682dd
--- /dev/null
+++ b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt
@@ -0,0 +1,28 @@
+--TEST--
+IntlDateFormatter::__construct(): bad timezone or calendar
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+ini_set("date.timezone", 'Atlantic/Azores');
+
+var_dump(new IntlDateFormatter(NULL, 0, 0, 'bad timezone'));
+
+var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, 3));
+
+var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, new stdclass));
+
+
+?>
+==DONE==
+--EXPECTF--
+
+Warning: IntlDateFormatter::__construct(): datefmt_create: no such time zone:
'bad timezone' in %s on line %d
+NULL
+
+Warning: IntlDateFormatter::__construct(): datefmt_create: invalid value for
calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's
default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an
IntlCalendar object in %s on line %d
+NULL
+
+Warning: IntlDateFormatter::__construct(): datefmt_create: Invalid calendar
argument; should be an integer or an IntlCalendar instance in %s on line %d
+NULL
+==DONE==
diff --git a/ext/intl/tests/dateformat_calendars.phpt
b/ext/intl/tests/dateformat_calendars.phpt
index 27f380c..6af02e5 100644
--- a/ext/intl/tests/dateformat_calendars.phpt
+++ b/ext/intl/tests/dateformat_calendars.phpt
@@ -41,5 +41,5 @@ string(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12"
string(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12"
string(42) "Sunday, Tevet 6, 5772 5:12:00 AM GMT+05:12"
-Warning: IntlDateFormatter::__construct(): datefmt_create: invalid value for
calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's
default calendar) or IntlDateFormatter::GREGORIAN in %s on line %d
+Warning: IntlDateFormatter::__construct(): datefmt_create: invalid value for
calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's
default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an
IntlCalendar object in %s on line %d
==DONE==
diff --git a/ext/intl/tests/dateformat_create_cal_arg.phpt
b/ext/intl/tests/dateformat_create_cal_arg.phpt
new file mode 100644
index 0000000..8e5f942
--- /dev/null
+++ b/ext/intl/tests/dateformat_create_cal_arg.phpt
@@ -0,0 +1,49 @@
+--TEST--
+IntlDateFormatter: several forms of the calendar arg
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+ini_set("date.timezone", 'Atlantic/Azores');
+
+$ts = strtotime('2012-01-01 00:00:00 UTC');
+
+$cal = new IntlGregorianCalendar('UTC', NULL);
+$df = new IntlDateFormatter('es_ES', 0, 0, NULL, $cal);
+echo $df->format($ts), "\n";
+
+$cal = IntlCalendar::createInstance('UTC', 'en@calendar=islamic');
+$df = new IntlDateFormatter('es_ES', 0, 0, NULL, $cal);
+echo $df->format($ts), "\n";
+
+//override calendar's timezone
+$cal = new IntlGregorianCalendar('UTC', NULL);
+$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Madrid', $cal);
+echo $df->format($ts), "\n";
+
+//default calendar is gregorian
+$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0);
+echo $df->format($ts), "\n";
+
+//try now with traditional
+$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, NULL,
IntlDateFormatter::TRADITIONAL);
+echo $df->format($ts), "\n";
+
+//the timezone can be overridden when not specifying a calendar
+$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, 'UTC',
IntlDateFormatter::TRADITIONAL);
+echo $df->format($ts), "\n";
+
+$df = new IntlDateFormatter('es_ES', 0, 0, 'UTC', 0);
+echo $df->format($ts), "\n";
+
+?>
+==DONE==
+--EXPECT--
+domingo, 1 de enero de 2012 00:00:00 GMT
+domingo, 8 de Safar de 1433 00:00:00 GMT
+domingo, 1 de enero de 2012 01:00:00 Hora estándar de Europa Central
+sábado, 31 de diciembre de 2011 d.C. 23:00:00 Hora estándar de las Azores
+sábado, 7 de Safar de 1433 AH 23:00:00 Hora estándar de las Azores
+domingo, 8 de Safar de 1433 AH 00:00:00 GMT
+domingo, 1 de enero de 2012 00:00:00 GMT
+==DONE==
diff --git a/ext/intl/tests/dateformat_format.phpt
b/ext/intl/tests/dateformat_format.phpt
index e554819..98f9d34 100755
--- a/ext/intl/tests/dateformat_format.phpt
+++ b/ext/intl/tests/dateformat_format.phpt
@@ -5,6 +5,8 @@ datefmt_format_code()
--FILE--
<?php
+//ini_set("intl.error_level", E_WARNING);
+
/*
* Test for the datefmt_format function
*/
@@ -12,7 +14,7 @@ datefmt_format_code()
function ut_main()
{
- $timezone = 'GMT-10';
+ $timezone = 'GMT-10:00';
$locale_arr = array (
'en_US'
diff --git a/ext/intl/tests/dateformat_format_parse.phpt
b/ext/intl/tests/dateformat_format_parse.phpt
index bd41d71..6bd3d8a 100755
--- a/ext/intl/tests/dateformat_format_parse.phpt
+++ b/ext/intl/tests/dateformat_format_parse.phpt
@@ -12,7 +12,7 @@ datefmt_format_code() and datefmt_parse_code()
function ut_main()
{
- $timezone = 'GMT+5';
+ $timezone = 'GMT+05:00';
$locale_arr = array (
'en_US'
diff --git a/ext/intl/tests/dateformat_getCalendarObject_error.phpt
b/ext/intl/tests/dateformat_getCalendarObject_error.phpt
new file mode 100644
index 0000000..22f12cb
--- /dev/null
+++ b/ext/intl/tests/dateformat_getCalendarObject_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+IntlDateFormatter::getCalendarObject(): bad args
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+ini_set("date.timezone", 'Atlantic/Azores');
+
+$df = new IntlDateFormatter(NULL, 0, 0);
+
+var_dump($df->getCalendarObject(9));
+var_dump(datefmt_get_calendar_object($df, 9));
+var_dump(datefmt_get_calendar_object($df, 9));
+var_dump(datefmt_get_calendar_object(new stdclass));
+
+?>
+==DONE==
+--EXPECTF--
+
+Warning: IntlDateFormatter::getCalendarObject() expects exactly 0 parameters,
1 given in %s on line %d
+
+Warning: IntlDateFormatter::getCalendarObject(): datefmt_get_calendar_object:
unable to parse input params in %s on line %d
+bool(false)
+
+Warning: datefmt_get_calendar_object() expects exactly 1 parameter, 2 given in
%s on line %d
+
+Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to
parse input params in %s on line %d
+bool(false)
+
+Warning: datefmt_get_calendar_object() expects exactly 1 parameter, 2 given in
%s on line %d
+
+Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to
parse input params in %s on line %d
+bool(false)
+
+Warning: datefmt_get_calendar_object() expects parameter 1 to be
IntlDateFormatter, object given in %s on line %d
+
+Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to
parse input params in %s on line %d
+bool(false)
+==DONE==
diff --git a/ext/intl/tests/dateformat_getTimeZone_error.phpt
b/ext/intl/tests/dateformat_getTimeZone_error.phpt
new file mode 100644
index 0000000..c9d49fd
--- /dev/null
+++ b/ext/intl/tests/dateformat_getTimeZone_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+IntlDateFormatter::getTimeZone(): bad args
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+ini_set("date.timezone", 'Atlantic/Azores');
+
+$df = new IntlDateFormatter(NULL, 0, 0);
+
+var_dump($df->getTimeZone(9));
+var_dump(datefmt_get_timezone($df, 9));
+var_dump(datefmt_get_timezone($df, 9));
+var_dump(datefmt_get_timezone(new stdclass));
+
+?>
+==DONE==
+--EXPECTF--
+
+Warning: IntlDateFormatter::getTimeZone() expects exactly 0 parameters, 1
given in %s on line %d
+
+Warning: IntlDateFormatter::getTimeZone(): datefmt_get_timezone: unable to
parse input params in %s on line %d
+bool(false)
+
+Warning: datefmt_get_timezone() expects exactly 1 parameter, 2 given in %s on
line %d
+
+Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input
params in %s on line %d
+bool(false)
+
+Warning: datefmt_get_timezone() expects exactly 1 parameter, 2 given in %s on
line %d
+
+Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input
params in %s on line %d
+bool(false)
+
+Warning: datefmt_get_timezone() expects parameter 1 to be IntlDateFormatter,
object given in %s on line %d
+
+Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input
params in %s on line %d
+bool(false)
+==DONE==
diff --git a/ext/intl/tests/dateformat_get_set_calendar.phpt
b/ext/intl/tests/dateformat_get_set_calendar.phpt
index bfd4e57..e792ea3 100755
--- a/ext/intl/tests/dateformat_get_set_calendar.phpt
+++ b/ext/intl/tests/dateformat_get_set_calendar.phpt
@@ -1,60 +1,51 @@
--TEST--
-datefmt_get_calendar_code() datefmt_set_calendar_code()
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject()
--FILE--
<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+ini_set("date.timezone", 'Atlantic/Azores');
+
+$ts = strtotime('2012-01-01 00:00:00 UTC');
+
+function d(IntlDateFormatter $df) {
+global $ts;
+echo $df->format($ts), "\n";
+var_dump($df->getCalendar(),
+$df->getCalendarObject()->getType(),
+$df->getCalendarObject()->getTimeZone()->getId());
+echo "\n";
+}
-/*
- * Test for the datefmt_get_calendar and datefmt_set_calendar functions
- */
-
-
-function ut_main()
-{
- $calendar_arr = array (
- IntlDateFormatter::GREGORIAN,
- IntlDateFormatter::TRADITIONAL,
- 3
- );
-
- $res_str = '';
-
- $start_calendar = IntlDateFormatter::GREGORIAN;
- $res_str .= "\nCreating IntlDateFormatter with calendar =
$start_calendar";
- $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT,
IntlDateFormatter::SHORT ,'America/Los_Angeles', IntlDateFormatter::GREGORIAN);
- $calendar = ut_datefmt_get_calendar( $fmt);
- $res_str .= "\nAfter call to get_calendar : calendar= $calendar";
- $res_str .= "\n-------------------";
-
- foreach( $calendar_arr as $calendar_entry )
- {
- $res_str .= "\nSetting IntlDateFormatter with calendar =
$calendar_entry";
- ut_datefmt_set_calendar( $fmt, $calendar_entry);
- $calendar = ut_datefmt_get_calendar( $fmt);
- $res_str .= "\nAfter call to get_calendar : calendar=
$calendar";
- $res_str .= "\n-------------------";
- }
-
- return $res_str;
+$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk');
+d($df);
-}
-include_once( 'ut_common.inc' );
+//changing the calendar with a cal type should not change tz
+$df->setCalendar(IntlDateFormatter::TRADITIONAL);
+d($df);
+
+//but changing with an actual calendar should
+$cal = IntlCalendar::createInstance("UTC");
+$df->setCalendar($cal);
+d($df);
-// Run the test
-ut_run();
?>
+==DONE==
--EXPECT--
-Creating IntlDateFormatter with calendar = 1
-After call to get_calendar : calendar= 1
--------------------
-Setting IntlDateFormatter with calendar = 1
-After call to get_calendar : calendar= 1
--------------------
-Setting IntlDateFormatter with calendar = 0
-After call to get_calendar : calendar= 0
--------------------
-Setting IntlDateFormatter with calendar = 3
-After call to get_calendar : calendar= 0
--------------------
\ No newline at end of file
+dimanche 1 janvier 2012 ap. J.-C. 03:00:00 UTC+03:00
+int(1)
+string(9) "gregorian"
+string(12) "Europe/Minsk"
+
+dimanche 8 Safar 1433 AH 03:00:00 UTC+03:00
+int(0)
+string(7) "islamic"
+string(12) "Europe/Minsk"
+
+dimanche 1 janvier 2012 ap. J.-C. 00:00:00 UTC
+bool(false)
+string(9) "gregorian"
+string(3) "UTC"
+
+==DONE==
diff --git a/ext/intl/tests/dateformat_get_set_timezone.phpt
b/ext/intl/tests/dateformat_get_set_timezone.phpt
new file mode 100644
index 0000000..50b036e
--- /dev/null
+++ b/ext/intl/tests/dateformat_get_set_timezone.phpt
@@ -0,0 +1,58 @@
+--TEST--
+IntlDateFormatter: get/setTimeZone()
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+ini_set("date.timezone", 'Atlantic/Azores');
+
+$ts = strtotime('2012-01-01 00:00:00 UTC');
+
+function d(IntlDateFormatter $df) {
+global $ts;
+echo $df->format($ts), "\n";
+var_dump(
+$df->getTimeZoneID(),
+$df->getTimeZone()->getID());
+echo "\n";
+}
+
+$df = new IntlDateFormatter('pt_PT', 0, 0, 'Europe/Minsk');
+d($df);
+
+$df->setTimeZone(NULL);
+d($df);
+
+$df->setTimeZone('Europe/Madrid');
+d($df);
+
+$df->setTimeZone(IntlTimeZone::createTimeZone('Europe/Paris'));
+d($df);
+
+$df->setTimeZone(new DateTimeZone('Europe/Amsterdam'));
+d($df);
+
+?>
+==DONE==
+--EXPECT--
+Domingo, 1 de Janeiro de 2012 3:00:00 GMT+03:00
+string(12) "Europe/Minsk"
+string(12) "Europe/Minsk"
+
+Sábado, 31 de Dezembro de 2011 23:00:00 Hora Padrão dos Açores
+string(15) "Atlantic/Azores"
+string(15) "Atlantic/Azores"
+
+Domingo, 1 de Janeiro de 2012 1:00:00 Hora Padrão da Europa Central
+string(13) "Europe/Madrid"
+string(13) "Europe/Madrid"
+
+Domingo, 1 de Janeiro de 2012 1:00:00 Hora Padrão da Europa Central
+string(12) "Europe/Paris"
+string(12) "Europe/Paris"
+
+Domingo, 1 de Janeiro de 2012 1:00:00 Hora Padrão da Europa Central
+string(16) "Europe/Amsterdam"
+string(16) "Europe/Amsterdam"
+
+==DONE==
diff --git a/ext/intl/tests/dateformat_get_timezone_id.phpt
b/ext/intl/tests/dateformat_get_timezone_id.phpt
index 80cbdbb..a9701c3 100755
--- a/ext/intl/tests/dateformat_get_timezone_id.phpt
+++ b/ext/intl/tests/dateformat_get_timezone_id.phpt
@@ -1,5 +1,8 @@
--TEST--
datefmt_get_timezone_id_code()
+--INI--
+date.timezone=Atlantic/Azores
+intl.error_level=E_WARNING
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
@@ -14,8 +17,8 @@ function ut_main()
{
$timezone_id_arr = array (
'America/New_York',
- 'America/Los_Angeles',
- 'America/Dallas'
+ 'US/Pacific',
+ 'US/Central'
);
$res_str = '';
@@ -42,8 +45,8 @@ ut_run();
Creating IntlDateFormatter with timezone_id = America/New_York
After call to get_timezone_id : timezone_id= America/New_York
-Creating IntlDateFormatter with timezone_id = America/Los_Angeles
-After call to get_timezone_id : timezone_id= America/Los_Angeles
+Creating IntlDateFormatter with timezone_id = US/Pacific
+After call to get_timezone_id : timezone_id= US/Pacific
-Creating IntlDateFormatter with timezone_id = America/Dallas
-After call to get_timezone_id : timezone_id= America/Dallas
+Creating IntlDateFormatter with timezone_id = US/Central
+After call to get_timezone_id : timezone_id= US/Central
diff --git a/ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt
b/ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt
new file mode 100644
index 0000000..ccc477d
--- /dev/null
+++ b/ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt
@@ -0,0 +1,18 @@
+--TEST--
+IntlDateFormatter: setTimeZoneID() deprecation
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+ini_set("date.timezone", 'Atlantic/Azores');
+
+$df = new IntlDateFormatter('pt_PT', 0, 0, 'Europe/Minsk');
+
+$df->setTimeZoneId('Europe/Madrid');
+
+?>
+==DONE==
+--EXPECTF--
+
+Deprecated: IntlDateFormatter::setTimeZoneId(): Use datefmt_set_timezone()
instead, which also accepts a plain time zone identifier and for which this
function is now an alias in %s on line %d
+==DONE==
diff --git a/ext/intl/tests/dateformat_setTimeZone_error.phpt
b/ext/intl/tests/dateformat_setTimeZone_error.phpt
new file mode 100644
index 0000000..8200197
--- /dev/null
+++ b/ext/intl/tests/dateformat_setTimeZone_error.phpt
@@ -0,0 +1,49 @@
+--TEST--
+IntlDateFormatter::setTimeZone() bad args
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+ini_set("date.timezone", 'Atlantic/Azores');
+
+$df = new IntlDateFormatter(NULL, 0, 0);
+
+var_dump($df->setTimeZone());
+var_dump(datefmt_set_timezone());
+var_dump($df->setTimeZone(array()));
+var_dump($df->setTimeZone(1, 2));
+var_dump($df->setTimeZone('non existing timezone'));
+var_dump(datefmt_set_timezone(new stdclass, 'UTC'));
+
+?>
+==DONE==
+--EXPECTF--
+
+Warning: IntlDateFormatter::setTimeZone() expects exactly 1 parameter, 0 given
in %s on line %d
+
+Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: unable to
parse input params in %s on line %d
+bool(false)
+
+Warning: datefmt_set_timezone() expects exactly 2 parameters, 0 given in %s on
line %d
+
+Warning: datefmt_set_timezone(): datefmt_set_timezone: unable to parse input
params in %s on line %d
+bool(false)
+
+Notice: Array to string conversion in %s on line %d
+
+Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time
zone: 'Array' in %s on line %d
+bool(false)
+
+Warning: IntlDateFormatter::setTimeZone() expects exactly 1 parameter, 2 given
in %s on line %d
+
+Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: unable to
parse input params in %s on line %d
+bool(false)
+
+Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time
zone: 'non existing timezone' in %s on line %d
+bool(false)
+
+Warning: datefmt_set_timezone() expects parameter 1 to be IntlDateFormatter,
object given in %s on line %d
+
+Warning: datefmt_set_timezone(): datefmt_set_timezone: unable to parse input
params in %s on line %d
+bool(false)
+==DONE==
diff --git a/ext/intl/tests/dateformat_set_timezone_id2.phpt
b/ext/intl/tests/dateformat_set_timezone_id2.phpt
index 23aacda..ce9b89d 100644
--- a/ext/intl/tests/dateformat_set_timezone_id2.phpt
+++ b/ext/intl/tests/dateformat_set_timezone_id2.phpt
@@ -1,11 +1,16 @@
--TEST--
datefmt_set_timezone_id_code() icu >= 4.8
+--INI--
+date.timezone=Atlantic/Azores
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
--FILE--
<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("error_reporting", ~E_DEPRECATED);
+
/*
* Test for the datefmt_set_timezone_id function
*/
@@ -23,7 +28,7 @@ function ut_main()
$res_str = '';
- $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL,
IntlDateFormatter::FULL, 'America/San_Francisco' , IntlDateFormatter::GREGORIAN
);
+ $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL,
IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN );
$timezone_id = ut_datefmt_get_timezone_id( $fmt );
$res_str .= "\nAfter creation of the dateformatter : timezone_id=
$timezone_id\n";
@@ -52,8 +57,13 @@ include_once( 'ut_common.inc' );
// Run the test
ut_run();
?>
---EXPECT--
-After creation of the dateformatter : timezone_id= America/San_Francisco
+--EXPECTF--
+
+Warning: IntlDateFormatter::setTimeZoneId(): datefmt_set_timezone: no such
time zone: 'CN' in %s on line %d
+
+Warning: datefmt_set_timezone_id(): datefmt_set_timezone: no such time zone:
'CN' in %s on line %d
+
+After creation of the dateformatter : timezone_id= US/Pacific
-----------
Trying to set timezone_id= America/New_York
After call to set_timezone_id : timezone_id= America/New_York
@@ -71,6 +81,6 @@ Formatting timestamp=0 resulted in Wednesday, December 31,
1969 6:00:00 PM Cent
Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 7:00:00 PM
Central Standard Time
-----------
Trying to set timezone_id= CN
-After call to set_timezone_id : timezone_id= CN
-Formatting timestamp=0 resulted in Thursday, January 1, 1970 12:00:00 AM GMT
-Formatting timestamp=3600 resulted in Thursday, January 1, 1970 1:00:00 AM GMT
+After call to set_timezone_id : timezone_id= America/Chicago
+Formatting timestamp=0 resulted in Wednesday, December 31, 1969 6:00:00 PM
Central Standard Time
+Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 7:00:00 PM
Central Standard Time
diff --git a/ext/intl/tests/dateformat_timezone_arg_variations.phpt
b/ext/intl/tests/dateformat_timezone_arg_variations.phpt
new file mode 100644
index 0000000..df3ebd8
--- /dev/null
+++ b/ext/intl/tests/dateformat_timezone_arg_variations.phpt
@@ -0,0 +1,41 @@
+--TEST--
+IntlDateFormatter: several forms of the timezone arg
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("date.timezone", 'Atlantic/Azores');
+
+$ts = strtotime('2012-01-01 00:00:00 UTC');
+
+//should use Atlantic/Azores
+$df = new IntlDateFormatter('es_ES', 0, 0, NULL);
+echo $df->format($ts), "\n";
+
+$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam');
+echo $df->format($ts), "\n";
+
+$df = new IntlDateFormatter('es_ES', 0, 0, new DateTimeZone('Europe/Lisbon'));
+echo $df->format($ts), "\n";
+
+$df = new IntlDateFormatter('es_ES', 0, 0,
IntlTimeZone::createTimeZone('America/New_York'));
+echo $df->format($ts), "\n";
+
+//time zone has priority
+$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam', new
IntlGregorianCalendar('Europe/Lisbon'));
+echo $df->format($ts), "\n";
+
+//calendar has priority
+$df = new IntlDateFormatter('es_ES', 0, 0, NULL, new
IntlGregorianCalendar('Europe/Lisbon'));
+echo $df->format($ts), "\n";
+
+$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam', 0);
+echo $df->format($ts), "\n";
+
+--EXPECTF--
+sábado%S 31 de diciembre de 2011 23:00:00 Hora%S de las Azores
+domingo%S 1 de enero de 2012 01:00:00 Hora estándar de Europa Central
+domingo%S 1 de enero de 2012 00:00:00 Hora%S de Europa Occidental
+sábado%S 31 de diciembre de 2011 19:00:00 Hora estándar oriental
+domingo%S 1 de enero de 2012 01:00:00 Hora estándar de Europa Central
+domingo%S 1 de enero de 2012 00:00:00 Hora%S de Europa Occidental
+domingo%S 1 de enero de 2012 01:00:00 Hora estándar de Europa Central
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php