diff options
author | Anatol Belski <ab@php.net> | 2014-11-20 12:58:41 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-11-20 12:58:41 +0100 |
commit | 96249b68e5dc3fbc7f26365216d0f31afcfae73a (patch) | |
tree | f89371c8c43aaa7d2e1e834359807a58b42bd922 /ext/intl | |
parent | 278d71e508c782fb91c0721f06e2f733bc7b27a0 (diff) | |
download | php-git-96249b68e5dc3fbc7f26365216d0f31afcfae73a.tar.gz |
split ext/intl/tests/dateformat_get_set_calendar_variant*.phpt for 54.1
Diffstat (limited to 'ext/intl')
3 files changed, 112 insertions, 1 deletions
diff --git a/ext/intl/tests/dateformat_get_set_calendar_variant2.phpt b/ext/intl/tests/dateformat_get_set_calendar_variant2.phpt index 1c5169e65d..9e8d76c1bb 100644 --- a/ext/intl/tests/dateformat_get_set_calendar_variant2.phpt +++ b/ext/intl/tests/dateformat_get_set_calendar_variant2.phpt @@ -3,7 +3,7 @@ IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() --SKIPIF-- <?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> -<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?> +<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?> --FILE-- <?php ini_set("intl.error_level", E_WARNING); diff --git a/ext/intl/tests/dateformat_get_set_calendar_variant3.phpt b/ext/intl/tests/dateformat_get_set_calendar_variant3.phpt new file mode 100644 index 0000000000..97f2911cfe --- /dev/null +++ b/ext/intl/tests/dateformat_get_set_calendar_variant3.phpt @@ -0,0 +1,56 @@ +--TEST-- +IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() +--SKIPIF-- +<?php +if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> +<?php if (version_compare(INTL_ICU_VERSION, '52.1') < 0) die('skip for ICU >= 52.1'); ?> +<?php if (version_compare(INTL_ICU_VERSION, '54.1') >= 0) die('skip for ICU < 54.1'); ?> +--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"; +} + +$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk'); +d($df); + + +//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); + +?> +==DONE== +--EXPECT-- +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_calendar_variant4.phpt b/ext/intl/tests/dateformat_get_set_calendar_variant4.phpt new file mode 100644 index 0000000000..89aa327b6a --- /dev/null +++ b/ext/intl/tests/dateformat_get_set_calendar_variant4.phpt @@ -0,0 +1,55 @@ +--TEST-- +IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() +--SKIPIF-- +<?php +if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> +<?php if (version_compare(INTL_ICU_VERSION, '52.1') < 0) die('skip for ICU >= 52.1'); ?> +--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"; +} + +$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk'); +d($df); + + +//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); + +?> +==DONE== +--EXPECT-- +dimanche 1 janvier 2012 ap. J.-C. à 03:00:00 heure de Kaliningrad +int(1) +string(9) "gregorian" +string(12) "Europe/Minsk" + +dimanche 8 safar 1433 AH à 03:00:00 heure de Kaliningrad +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== |