ext/intl: modernize tests (#19392)

This is effectively removing ZPP tests, enabling warnings, and moving INI settings into the INI PHPT block
This commit is contained in:
Gina Peter Banyard 2025-08-06 23:33:48 +01:00 committed by GitHub
parent 3fc0149325
commit c42e6d62d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
222 changed files with 427 additions and 1624 deletions

View file

@ -4,12 +4,12 @@ IntlBreakIterator::__construct() should not be callable
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
new IntlBreakIterator();
try {
new IntlBreakIterator();
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Fatal error: Uncaught Error: Call to private IntlBreakIterator::__construct() from global scope in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
--EXPECT--
Error: Call to private IntlBreakIterator::__construct() from global scope

View file

@ -5,53 +5,44 @@ intl
--FILE--
<?php
function print_exception($e) {
echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
}
//missing ; at the end:
try {
var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+'));
} catch (IntlException $e) {
print_exception($e);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(new IntlRuleBasedBreakIterator());
} catch (TypeError $e) {
print_exception($e);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(new IntlRuleBasedBreakIterator(1,2,3));
} catch (TypeError $e) {
print_exception($e);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', array()));
} catch (TypeError $e) {
print_exception($e);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', true));
} catch (IntlException $e) {
print_exception($e);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
$rbbi = new IntlRuleBasedBreakIterator(".;");
try {
$rbbi->__construct(".;");
} catch (Error $e) {
print_exception($e);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Exception: IntlRuleBasedBreakIterator::__construct(): unable to create RuleBasedBreakIterator from rules (parse error on line 1, offset 31) in %s on line %d
Exception: IntlRuleBasedBreakIterator::__construct() expects at least 1 argument, 0 given in %s on line %d
Exception: IntlRuleBasedBreakIterator::__construct() expects at most 2 arguments, 3 given in %s on line %d
Exception: IntlRuleBasedBreakIterator::__construct(): Argument #2 ($compiled) must be of type bool, array given in %s on line %d
Exception: IntlRuleBasedBreakIterator::__construct(): unable to create instance from compiled rules in %s on line %d
Exception: IntlRuleBasedBreakIterator object is already constructed in %s on line %d
--EXPECT--
IntlException: IntlRuleBasedBreakIterator::__construct(): unable to create RuleBasedBreakIterator from rules (parse error on line 1, offset 31)
ArgumentCountError: IntlRuleBasedBreakIterator::__construct() expects at least 1 argument, 0 given
ArgumentCountError: IntlRuleBasedBreakIterator::__construct() expects at most 2 arguments, 3 given
TypeError: IntlRuleBasedBreakIterator::__construct(): Argument #2 ($compiled) must be of type bool, array given
IntlException: IntlRuleBasedBreakIterator::__construct(): unable to create instance from compiled rules
Error: IntlRuleBasedBreakIterator object is already constructed

View file

@ -4,7 +4,6 @@ IntlBreakIterator: clone handler
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;');
$bi_clone = clone $bi;

View file

@ -2,10 +2,10 @@
IntlBreakIterator::createCodePointInstance(): basic test
--EXTENSIONS--
intl
--INI--
intl.default_locale=pt_PT
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$text = 'ตัวอย่างข้อความ';

View file

@ -4,8 +4,6 @@ IntlBreakIterator::current(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$bi = IntlBreakIterator::createWordInstance('pt');
var_dump($bi->current());

View file

@ -2,10 +2,10 @@
IntlBreakIterator factories: basic tests
--EXTENSIONS--
intl
--INI--
intl.default_locale=ja
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "ja");
$m = array('createWordInstance', 'createLineInstance', 'createCharacterInstance',
'createSentenceInstance', 'createTitleInstance');

View file

@ -4,7 +4,6 @@ IntlBreakIterator::first(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans');

View file

@ -4,8 +4,6 @@ IntlBreakIterator::following(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans zoo bee');

View file

@ -6,8 +6,6 @@ intl
<?php if (version_compare(INTL_ICU_VERSION, '64.0') >= 0) die('skip for ICU < 64.0'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$bi = IntlBreakIterator::createSentenceInstance('pt');

View file

@ -6,8 +6,6 @@ intl
<?php if (version_compare(INTL_ICU_VERSION, '64.0') < 0) die('skip for ICU >= 64.0'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$bi = IntlBreakIterator::createSentenceInstance('pt');

View file

@ -8,8 +8,6 @@ if (version_compare(INTL_ICU_VERSION, '57.1') > 0) die('skip for ICU <= 57.1');
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$bi = IntlBreakIterator::createWordInstance('pt');
$pi = $bi->getPartsIterator();

View file

@ -8,8 +8,6 @@ if (version_compare(INTL_ICU_VERSION, '57.1') <= 0) die('skip for ICU > 57.1');
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$bi = IntlBreakIterator::createWordInstance('pt');
$pi = $bi->getPartsIterator();

View file

@ -4,7 +4,6 @@ IntlBreakIterator::getPartsIterator(): bad args
intl
--FILE--
<?php
ini_set("intl.default_locale", "pt_PT");
$it = IntlBreakIterator::createWordInstance(NULL);

View file

@ -2,10 +2,10 @@
IntlBreakIterator::getPartsIterator(): argument variations
--EXTENSIONS--
intl
--INI--
intl.default_locale=pt_PT
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$text = 'foo bar tao';

View file

@ -4,7 +4,6 @@ IntlBreakIterator::getText(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$bi = IntlBreakIterator::createWordInstance('pt');
var_dump($bi->getText());

View file

@ -4,8 +4,6 @@ IntlBreakIterator::isBoundary(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans zoo bee');

View file

@ -4,7 +4,6 @@ IntlBreakIterator::last(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans');

View file

@ -4,8 +4,6 @@ IntlBreakIterator::next(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans zoo bee');

View file

@ -8,8 +8,6 @@ if (version_compare(INTL_ICU_VERSION, '57.1') > 0) die('skip for ICU <= 57.1');
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans zoo bee');

View file

@ -8,8 +8,6 @@ if (version_compare(INTL_ICU_VERSION, '57.1') <= 0) die('skip for ICU > 57.1');
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans zoo bee');

View file

@ -4,8 +4,6 @@ IntlBreakIterator::previous(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans');

View file

@ -4,7 +4,6 @@ IntlBreakIterator::setText(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
class A {
function __tostring() { return 'aaa'; }

View file

@ -2,6 +2,8 @@
Bug #58756: w.r.t MessageFormatter
--EXTENSIONS--
intl
--INI--
date.timezone=America/New_York
--SKIPIF--
<?php
if (str_contains(PHP_OS, 'FreeBSD')) {
@ -10,13 +12,9 @@ if (str_contains(PHP_OS, 'FreeBSD')) {
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
//ini_set("intl.default_locale", "nl");
$time = 1247013673;
ini_set('date.timezone', 'America/New_York');
$msgf = new MessageFormatter('en_US', '{0,date,full} {0,time,h:m:s a V}');
echo "date: " . date('l, F j, Y g:i:s A T', $time) . "\n";

View file

@ -11,11 +11,11 @@ class Collator2 extends Collator{
}
$c = new Collator2();
$a = $c->compare('h', 'H');
try {
$a = $c->compare('h', 'H');
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Fatal error: Uncaught Error: Object not initialized in %s:%d
Stack trace:
#0 %s(%d): Collator->compare('h', 'H')
#1 {main}
thrown in %s on line %d
--EXPECT--
Error: Object not initialized

View file

@ -12,11 +12,11 @@ class Collator2 extends Collator{
}
$c = new Collator2();
$c->getLocale(Locale::ACTUAL_LOCALE);
try {
$c->getLocale(Locale::ACTUAL_LOCALE);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Fatal error: Uncaught Error: Object not initialized in %s:%d
Stack trace:
#0 %s(%d): Collator->getLocale(0)
#1 {main}
thrown in %s on line %d
--EXPECT--
Error: Object not initialized

View file

@ -12,11 +12,11 @@ class Collator2 extends Collator{
}
$c = new Collator2();
$c->getSortKey('h');
try {
$c->getSortKey('h');
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Fatal error: Uncaught Error: Object not initialized in %s:%d
Stack trace:
#0 %s(%d): Collator->getSortKey('h')
#1 {main}
thrown in %s on line %d
--EXPECT--
Error: Object not initialized

View file

@ -13,11 +13,11 @@ class Collator2 extends Collator{
$c = new Collator2();
$a = array('a', 'b');
$c->sort($a);
try {
$c->sort($a);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Fatal error: Uncaught Error: Object not initialized in %s:%d
Stack trace:
#0 %s(%d): Collator->sort(Array)
#1 {main}
thrown in %s on line %d
--EXPECT--
Error: Object not initialized

View file

@ -13,11 +13,11 @@ class Collator2 extends Collator{
$c = new Collator2();
$a = array('a', 'b');
$c->sortWithSortKeys($a);
try {
$c->sortWithSortKeys($a);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Fatal error: Uncaught Error: Object not initialized in %s:%d
Stack trace:
#0 %s(%d): Collator->sortWithSortKeys(Array)
#1 {main}
thrown in %s on line %d
--EXPECT--
Error: Object not initialized

View file

@ -6,7 +6,6 @@ date.timezone=Atlantic/Azores
intl
--FILE--
<?php
ini_set('intl.error_level', E_WARNING);
$x = new IntlDateFormatter('en', 1, 1);
try {
var_dump($x->__construct('en', 1, 1));

View file

@ -2,12 +2,11 @@
IntlCalendar::add() basic test
--INI--
date.timezone=Atlantic/Azores
intl.default_locale=nl
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$time = strtotime('2012-02-29 00:00:00 +0000');
$time2 = strtotime('2012-03-01 05:06:07 +0000');

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::add(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_add(1, 2, 3));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: intlcal_add(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_add(1, 2, 3)
#1 {main}
thrown in %s on line %d

View file

@ -1,77 +0,0 @@
--TEST--
IntlCalendar::before()/after(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
function eh($errno, $errstr) {
echo "error: $errno, $errstr\n";
}
set_error_handler('eh');
try {
var_dump($c->after());
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump($c->before());
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump($c->after(1));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump($c->before(1));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try{
var_dump($c->after($c, 1));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump($c->before($c, 1));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump(intlcal_after($c));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump(intlcal_before($c));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
?>
--EXPECT--
error: 0, IntlCalendar::after() expects exactly 1 argument, 0 given
error: 0, IntlCalendar::before() expects exactly 1 argument, 0 given
error: 0, IntlCalendar::after(): Argument #1 ($other) must be of type IntlCalendar, int given
error: 0, IntlCalendar::before(): Argument #1 ($other) must be of type IntlCalendar, int given
error: 0, IntlCalendar::after() expects exactly 1 argument, 2 given
error: 0, IntlCalendar::before() expects exactly 1 argument, 2 given
error: 0, intlcal_after() expects exactly 2 arguments, 1 given
error: 0, intlcal_before() expects exactly 2 arguments, 1 given

View file

@ -2,10 +2,10 @@
IntlCalendar::clear() basic test
--EXTENSIONS--
intl
--INI--
intl.default_locale=nl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
var_dump($intlcal->clear());

View file

@ -1,7 +1,5 @@
--TEST--
IntlCalendar::clear(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
@ -20,13 +18,7 @@ try {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_clear(1, 2));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
IntlCalendar::clear(): Argument #1 ($field) must be a valid field
intlcal_clear(): Argument #2 ($field) must be a valid field
intlcal_clear(): Argument #1 ($calendar) must be of type IntlCalendar, int given

View file

@ -1,7 +1,7 @@
--TEST--
IntlCalendar::clear() 1 arg variation
--INI--
date.timezone=Atlantic/Azores
intl.default_locale=nl
--EXTENSIONS--
intl
--SKIPIF--
@ -12,16 +12,14 @@ if (version_compare(INTL_ICU_VERSION, '73.1') >= 0 && version_compare(INTL_ICU_V
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
$intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000);
//print_R($intlcal);
var_dump($intlcal->isSet(IntlCalendar::FIELD_MONTH));
var_dump($intlcal->clear(IntlCalendar::FIELD_MONTH));
var_dump($intlcal->isSet(IntlCalendar::FIELD_MONTH));
//print_R($intlcal);
var_dump(
$intlcal->getTime(),
strtotime('2012-01-29 05:06:07 +0000') * 1000.

View file

@ -2,12 +2,11 @@
IntlCalendar::createInstance() basic test
--EXTENSIONS--
intl
--INI--
intl.default_locale=nl
date.timezone=Europe/Amsterdam
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
date_default_timezone_set('Europe/Amsterdam');
$cal = IntlCalendar::createInstance();
print_R($cal->getTimeZone());

View file

@ -4,7 +4,6 @@ IntlCalendar::createInstance: bad arguments
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
class X extends IntlTimeZone {
function __construct() {}

View file

@ -2,12 +2,11 @@
IntlCalendar::createInstance() argument variations
--EXTENSIONS--
intl
--INI--
date.timezone=Europe/Amsterdam
intl.default_locale=nl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
date_default_timezone_set('Europe/Amsterdam');
$cal = intlcal_create_instance('Europe/Amsterdam');
print_R($cal->getTimeZone());

View file

@ -2,12 +2,11 @@
IntlCalendar::equals(), ::before() and ::after() basic test
--INI--
date.timezone=Atlantic/Azores
intl.default_locale=nl
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal1 = IntlGregorianCalendar::createFromDateTime(2012, 1, 29, 16, 59, 59);
$intlcal2 = IntlCalendar::createInstance(null, '@calendar=japanese');

View file

@ -1,55 +0,0 @@
--TEST--
IntlCalendar::equals(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
function eh($errno, $errstr) {
echo "error: $errno, $errstr\n";
}
set_error_handler('eh');
try {
var_dump($c->equals());
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump($c->equals(new stdclass));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump($c->equals(1, 2));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump(intlcal_equals($c, array()));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump(intlcal_equals(1, $c));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
?>
--EXPECT--
error: 0, IntlCalendar::equals() expects exactly 1 argument, 0 given
error: 0, IntlCalendar::equals(): Argument #1 ($other) must be of type IntlCalendar, stdClass given
error: 0, IntlCalendar::equals() expects exactly 1 argument, 2 given
error: 0, intlcal_equals(): Argument #2 ($other) must be of type IntlCalendar, array given
error: 0, intlcal_equals(): Argument #1 ($calendar) must be of type IntlCalendar, int given

View file

@ -2,12 +2,11 @@
IntlCalendar::fieldDifference() basic test
--INI--
date.timezone=Atlantic/Azores
intl.default_locale=nl
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
$intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000);

View file

@ -1,38 +1,16 @@
--TEST--
IntlCalendar::fieldDifference(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
try {
var_dump($c->fieldDifference($c, 2, 3));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
var_dump($c->fieldDifference(INF, 2));
var_dump($c->getErrorMessage());
try {
var_dump(intlcal_field_difference($c, 0, 1, 2));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
var_dump(intlcal_field_difference(1, 0, 1));
?>
--EXPECTF--
IntlCalendar::fieldDifference() expects exactly 2 arguments, 3 given
Warning: IntlCalendar::fieldDifference(): Call to ICU method has failed in %s on line %d
--EXPECT--
bool(false)
intlcal_field_difference() expects exactly 3 arguments, 4 given
Fatal error: Uncaught TypeError: intlcal_field_difference(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_field_difference(1, 0, 1)
#1 {main}
thrown in %s on line %d
string(88) "IntlCalendar::fieldDifference(): Call to ICU method has failed: U_ILLEGAL_ARGUMENT_ERROR"

View file

@ -2,11 +2,11 @@
IntlCalendar::fromDateTime(): basic test
--EXTENSIONS--
intl
--INI--
intl.default_locale=nl_NL
date.timezone=Europe/Lisbon
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl_NL");
date_default_timezone_set('Europe/Lisbon');
$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00 Europe/Rome');
var_dump(

View file

@ -2,36 +2,39 @@
IntlCalendar::fromDateTime(): errors
--EXTENSIONS--
intl
--INI--
intl.default_locale=nl
date.timezone=Europe/Lisbon
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
date_default_timezone_set('Europe/Lisbon');
try {
IntlCalendar::fromDateTime("foobar");
} catch (Exception $e) {
echo "threw exception, OK";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
class A extends DateTime {
function __construct() {}
function __construct() {}
}
var_dump(IntlCalendar::fromDateTime(new A));
var_dump(intl_get_error_message());
$date = new DateTime('2012-01-01 00:00:00 +24:00');
var_dump(IntlCalendar::fromDateTime($date));
var_dump(intl_get_error_message());
$date = new DateTime('2012-01-01 00:00:00 WEST');
var_dump(IntlCalendar::fromDateTime($date));
var_dump(intl_get_error_message());
?>
--EXPECTF--
threw exception, OK
Warning: IntlCalendar::fromDateTime(): DateTime object is unconstructed in %s on line %d
--EXPECT--
DateMalformedStringException: Failed to parse time string (foobar) at position 0 (f): The timezone could not be found in the database
NULL
Warning: IntlCalendar::fromDateTime(): object has an time zone offset that's too large in %s on line %d
string(88) "IntlCalendar::fromDateTime(): DateTime object is unconstructed: U_ILLEGAL_ARGUMENT_ERROR"
NULL
Warning: IntlCalendar::fromDateTime(): time zone id 'WEST' extracted from ext/date DateTimeZone not recognized in %s on line %d
string(103) "IntlCalendar::fromDateTime(): object has an time zone offset that's too large: U_ILLEGAL_ARGUMENT_ERROR"
NULL
string(127) "IntlCalendar::fromDateTime(): time zone id 'WEST' extracted from ext/date DateTimeZone not recognized: U_ILLEGAL_ARGUMENT_ERROR"

View file

@ -2,10 +2,10 @@
IntlCalendar::getAvailableLocales() basic test
--EXTENSIONS--
intl
--INI--
intl.default_locale=nl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$locales = IntlCalendar::getAvailableLocales();
var_dump(count($locales) > 100);

View file

@ -1,13 +1,9 @@
--TEST--
IntlCalendar::getDayOfWeekType() basic test
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
$intlcal->setTime(strtotime('2012-02-29 00:00:00 +0000') * 1000);

View file

@ -1,7 +1,5 @@
--TEST--
IntlCalendar::getDayOfWeekOfType(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
@ -14,12 +12,6 @@ try {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get_day_of_week_type(1, 1));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
IntlCalendar::getDayOfWeekType(): Argument #1 ($dayOfWeek) must be a valid day of the week
intlcal_get_day_of_week_type(): Argument #1 ($calendar) must be of type IntlCalendar, int given

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::getErrorCode(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_get_error_code(null));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: intlcal_get_error_code(): Argument #1 ($calendar) must be of type IntlCalendar, null given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_error_code(NULL)
#1 {main}
thrown in %s on line %d

View file

@ -2,37 +2,34 @@
IntlCalendar::getErrorCode(), ::getErrorMessage() basic test
--INI--
date.timezone=Atlantic/Azores
intl.default_locale=nl
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlGregorianCalendar::createFromDate(2012, 1, 29);
var_dump(
$intlcal->getErrorCode(),
intlcal_get_error_code($intlcal),
$intlcal->getErrorMessage(),
intlcal_get_error_message($intlcal)
$intlcal->getErrorCode(),
intlcal_get_error_code($intlcal),
$intlcal->getErrorMessage(),
intlcal_get_error_message($intlcal)
);
$intlcal->add(IntlCalendar::FIELD_SECOND, 2147483647);
$intlcal->fieldDifference(-PHP_INT_MAX, IntlCalendar::FIELD_SECOND);
var_dump(
$intlcal->getErrorCode(),
intlcal_get_error_code($intlcal),
$intlcal->getErrorMessage(),
intlcal_get_error_message($intlcal)
$intlcal->getErrorCode(),
intlcal_get_error_code($intlcal),
$intlcal->getErrorMessage(),
intlcal_get_error_message($intlcal)
);
?>
--EXPECTF--
--EXPECT--
int(0)
int(0)
string(12) "U_ZERO_ERROR"
string(12) "U_ZERO_ERROR"
Warning: IntlCalendar::fieldDifference(): Call to ICU method has failed in %s on line %d
int(1)
int(1)
string(88) "IntlCalendar::fieldDifference(): Call to ICU method has failed: U_ILLEGAL_ARGUMENT_ERROR"

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::getErrorMessage(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_get_error_message(null));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: intlcal_get_error_message(): Argument #1 ($calendar) must be of type IntlCalendar, null given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_error_message(NULL)
#1 {main}
thrown in %s on line %d

View file

@ -2,10 +2,10 @@
IntlCalendar::getFirstDayOfWeek() basic test
--EXTENSIONS--
intl
--INI--
intl.default_locale=nl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
var_dump($intlcal->getFirstDayOfWeek());

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::getFirstDayOfWeek(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_get_first_day_of_week(1));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: intlcal_get_first_day_of_week(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_first_day_of_week(1)
#1 {main}
thrown in %s on line %d

View file

@ -4,27 +4,20 @@ IntlCalendar::getKeywordValuesForLocale() basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
print_r(
iterator_to_array(
IntlCalendar::getKeywordValuesForLocale('calendar', 'pt', true)
));
var_dump(iterator_to_array(IntlCalendar::getKeywordValuesForLocale('calendar', 'pt', true)));
echo "\n";
$var = iterator_to_array(
intlcal_get_keyword_values_for_locale('calendar', 'pt', false)
);
$var = iterator_to_array(intlcal_get_keyword_values_for_locale('calendar', 'pt', false));
var_dump(count($var) > 8);
var_dump(in_array('japanese', $var));
?>
--EXPECT--
Array
(
[0] => gregorian
)
array(1) {
[0]=>
string(9) "gregorian"
}
bool(true)
bool(true)

View file

@ -2,10 +2,10 @@
IntlCalendar::getLocale() basic test
--EXTENSIONS--
intl
--INI--
intl.default_locale=nl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
var_dump($intlcal->getLocale(Locale::ACTUAL_LOCALE));

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::getLocale(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_get_locale(1));
?>
--EXPECTF--
Fatal error: Uncaught ArgumentCountError: intlcal_get_locale() expects exactly 2 arguments, 1 given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_locale(1)
#1 {main}
thrown in %s on line %d

View file

@ -2,10 +2,10 @@
IntlCalendar::getMinimalDaysInFirstWeek() basic test
--EXTENSIONS--
intl
--INI--
intl.default_locale=nl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
var_dump($intlcal->getMinimalDaysInFirstWeek());

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::getMinimalDaysInFirstWeek(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_get_minimal_days_in_first_week(1));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: intlcal_get_minimal_days_in_first_week(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_minimal_days_in_first_week(1)
#1 {main}
thrown in %s on line %d

View file

@ -4,8 +4,6 @@ IntlCalendar::getNow() basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$now = IntlCalendar::getNow();
$proc_now = intlcal_get_now();

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::getSkipped/RepeatedWallTimeOption(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_get_skipped_wall_time_option(1));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: intlcal_get_skipped_wall_time_option(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_skipped_wall_time_option(1)
#1 {main}
thrown in %s on line %d

View file

@ -4,8 +4,6 @@ IntlCalendar::getTimeZone() basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('GMT+00:01');
print_r($intlcal->getTimeZone());

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::getTimeZone(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_get_time_zone(1));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: intlcal_get_time_zone(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_time_zone(1)
#1 {main}
thrown in %s on line %d

View file

@ -1,13 +1,9 @@
--TEST--
IntlCalendar::getTime() basic test
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
$intlcal->clear();

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::getTime(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_get_time(1));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: intlcal_get_time(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_time(1)
#1 {main}
thrown in %s on line %d

View file

@ -1,18 +1,14 @@
--TEST--
IntlCalendar::getType() basic test
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance();
VAR_DUMP($intlcal->getType());
var_dump($intlcal->getType());
$intlcal = IntlCalendar::createInstance(null, "nl_NL@calendar=hebrew");
VAR_DUMP(intlcal_get_type($intlcal));
var_dump(intlcal_get_type($intlcal));
?>
--EXPECT--
string(9) "gregorian"

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::getType(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_get_type(1));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: intlcal_get_type(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_type(1)
#1 {main}
thrown in %s on line %d

View file

@ -6,8 +6,6 @@ date.timezone=Atlantic/Azores
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance();
var_dump($intlcal->getWeekendTransition(IntlCalendar::DOW_SUNDAY));

View file

@ -1,12 +1,9 @@
--TEST--
IntlCalendar::getWeekendTransition(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
@ -16,13 +13,6 @@ try {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get_weekend_transition(1, 1));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
IntlCalendar::getWeekendTransition(): Argument #1 ($dayOfWeek) must be a valid day of the week
intlcal_get_weekend_transition(): Argument #1 ($calendar) must be of type IntlCalendar, int given

View file

@ -1,13 +1,9 @@
--TEST--
IntlCalendar::getMaximum(), ::getActualMaximum(), ::getLeastMaximum() basic test
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
$intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000);

View file

@ -1,13 +1,9 @@
--TEST--
IntlCalendar::getMinimum(), ::getActualMinimum(), ::getGreatestMinimum() basic test
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
$intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000);

View file

@ -1,7 +1,5 @@
--TEST--
IntlCalendar::get/Least/Greatest/Minimum/Maximum(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
@ -51,26 +49,6 @@ try {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get_least_maximum(1, 1));
} catch (Error $e) {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get_maximum(1, 1));
} catch (Error $e) {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get_greatest_minimum(1, -1));
} catch (Error $e) {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get_minimum(1, -1));
} catch (Error $e) {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
ValueError: 0, IntlCalendar::getLeastMaximum(): Argument #1 ($field) must be a valid field
@ -81,7 +59,3 @@ ValueError: 0, intlcal_get_least_maximum(): Argument #2 ($field) must be a valid
ValueError: 0, intlcal_get_maximum(): Argument #2 ($field) must be a valid field
ValueError: 0, intlcal_get_greatest_minimum(): Argument #2 ($field) must be a valid field
ValueError: 0, intlcal_get_minimum(): Argument #2 ($field) must be a valid field
TypeError: 0, intlcal_get_least_maximum(): Argument #1 ($calendar) must be of type IntlCalendar, int given
TypeError: 0, intlcal_get_maximum(): Argument #1 ($calendar) must be of type IntlCalendar, int given
TypeError: 0, intlcal_get_greatest_minimum(): Argument #1 ($calendar) must be of type IntlCalendar, int given
TypeError: 0, intlcal_get_minimum(): Argument #1 ($calendar) must be of type IntlCalendar, int given

View file

@ -4,8 +4,6 @@ IntlCalendar::get() basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
$intlcal->set(IntlCalendar::FIELD_DAY_OF_MONTH, 4);

View file

@ -1,7 +1,5 @@
--TEST--
IntlCalendar::get/getActualMaximum/getActualMinimum(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--

View file

@ -1,7 +1,5 @@
--TEST--
IntlCalendar::get/getActualMaximum/getActualMinimum(): bad arguments (procedural)
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
@ -9,22 +7,6 @@ intl
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
try {
var_dump(intlcal_get($c));
} catch (Error $e) {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get_actual_maximum($c));
} catch (Error $e) {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get_actual_minimum($c));
} catch (Error $e) {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get($c, -1));
} catch (Error $e) {
@ -41,48 +23,8 @@ try {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get($c, "s"));
} catch (Error $e) {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get_actual_maximum($c, "s"));
} catch (Error $e) {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get_actual_minimum($c, "s"));
} catch (Error $e) {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get(1));
} catch (Error $e) {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get_actual_maximum(1));
} catch (Error $e) {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_get_actual_minimum(1));
} catch (Error $e) {
echo get_class($e) . ': ' . $e->getCode() . ', ' . $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
ArgumentCountError: 0, intlcal_get() expects exactly 2 arguments, 1 given
ArgumentCountError: 0, intlcal_get_actual_maximum() expects exactly 2 arguments, 1 given
ArgumentCountError: 0, intlcal_get_actual_minimum() expects exactly 2 arguments, 1 given
ValueError: 0, intlcal_get(): Argument #2 ($field) must be a valid field
ValueError: 0, intlcal_get_actual_maximum(): Argument #2 ($field) must be a valid field
ValueError: 0, intlcal_get_actual_minimum(): Argument #2 ($field) must be a valid field
TypeError: 0, intlcal_get(): Argument #2 ($field) must be of type int, string given
TypeError: 0, intlcal_get_actual_maximum(): Argument #2 ($field) must be of type int, string given
TypeError: 0, intlcal_get_actual_minimum(): Argument #2 ($field) must be of type int, string given
ArgumentCountError: 0, intlcal_get() expects exactly 2 arguments, 1 given
ArgumentCountError: 0, intlcal_get_actual_maximum() expects exactly 2 arguments, 1 given
ArgumentCountError: 0, intlcal_get_actual_minimum() expects exactly 2 arguments, 1 given

View file

@ -2,12 +2,11 @@
IntlCalendar::get/setRepeatedWallTimeOption(): basic test
--EXTENSIONS--
intl
--INI--
intl.default_locale=nl
date.timezone=Europe/Amsterdam
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
date_default_timezone_set('Europe/Amsterdam');
//28 October 2012, transition from DST
$intlcal = IntlGregorianCalendar::createFromDateTime(2012, 9, 28, 0, 0, 0);

View file

@ -2,12 +2,11 @@
IntlCalendar::get/setSkippedWallTimeOption(): basic test
--EXTENSIONS--
intl
--INI--
intl.default_locale=nl
date.timezone=Europe/Amsterdam
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
date_default_timezone_set('Europe/Amsterdam');
//25 March 2012, transition to DST
$intlcal = new IntlGregorianCalendar(2012, 2, 25, 0, 0, 0);

View file

@ -1,13 +1,9 @@
--TEST--
IntlCalendar::inDaylightTime() basic test
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('Europe/Amsterdam');
$intlcal->setTime(strtotime('2012-01-01') * 1000);

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::inDaylightTime(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_in_daylight_time(1));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: intlcal_in_daylight_time(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_in_daylight_time(1)
#1 {main}
thrown in %s on line %d

View file

@ -4,8 +4,6 @@ IntlCalendar::isEquivalentTo() basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal1 = IntlCalendar::createInstance('Europe/Amsterdam');
$intlcal2 = IntlCalendar::createInstance('Europe/Lisbon');

View file

@ -1,61 +0,0 @@
--TEST--
IntlCalendar::isEquivalentTo(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
function eh($errno, $errstr) {
echo "error: $errno, $errstr\n";
}
set_error_handler('eh');
try {
var_dump($c->isEquivalentTo(0));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump($c->isEquivalentTo($c, 1));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump($c->isEquivalentTo(1));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump(intlcal_is_equivalent_to($c));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump(intlcal_is_equivalent_to($c, 1));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump(intlcal_is_equivalent_to(1, $c));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
?>
--EXPECT--
error: 0, IntlCalendar::isEquivalentTo(): Argument #1 ($other) must be of type IntlCalendar, int given
error: 0, IntlCalendar::isEquivalentTo() expects exactly 1 argument, 2 given
error: 0, IntlCalendar::isEquivalentTo(): Argument #1 ($other) must be of type IntlCalendar, int given
error: 0, intlcal_is_equivalent_to() expects exactly 2 arguments, 1 given
error: 0, intlcal_is_equivalent_to(): Argument #2 ($other) must be of type IntlCalendar, int given
error: 0, intlcal_is_equivalent_to(): Argument #1 ($calendar) must be of type IntlCalendar, int given

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::isLenient(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_is_lenient(1));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: intlcal_is_lenient(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_is_lenient(1)
#1 {main}
thrown in %s on line %d

View file

@ -4,8 +4,6 @@ IntlCalendar::isSet() basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
var_dump($intlcal->isSet(IntlCalendar::FIELD_MINUTE));

View file

@ -1,7 +1,5 @@
--TEST--
IntlCalendar::isSet(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
@ -15,12 +13,6 @@ try {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_is_set(1, 2));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
IntlCalendar::isSet(): Argument #1 ($field) must be a valid field
intlcal_is_set(): Argument #1 ($calendar) must be of type IntlCalendar, int given

View file

@ -1,13 +1,9 @@
--TEST--
IntlCalendar::isWeekend basic test
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
var_dump($intlcal->isWeekend(strtotime('2012-02-29 12:00:00 +0000') * 1000));

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::isWeekend(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_is_weekend(1));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: intlcal_is_weekend(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_is_weekend(1)
#1 {main}
thrown in %s on line %d

View file

@ -4,8 +4,6 @@ IntlCalendar::isLenient(), ::setLenient() basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal1 = IntlCalendar::createInstance('UTC');
var_dump($intlcal1->isLenient());

View file

@ -6,8 +6,6 @@ date.timezone=Atlantic/Azores
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = new IntlGregorianCalendar(2012, 1, 28);
var_dump($intlcal->roll(IntlCalendar::FIELD_DAY_OF_MONTH, 2));

View file

@ -1,7 +1,5 @@
--TEST--
IntlCalendar::roll(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
@ -15,12 +13,6 @@ try {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_roll(1, 2, 3));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
IntlCalendar::roll(): Argument #1 ($field) must be a valid field
intlcal_roll(): Argument #1 ($calendar) must be of type IntlCalendar, int given

View file

@ -6,8 +6,6 @@ date.timezone=Atlantic/Azores
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = new IntlGregorianCalendar(2012, 1, 28);
var_dump($intlcal->roll(IntlCalendar::FIELD_DAY_OF_MONTH, true));

View file

@ -4,8 +4,6 @@ IntlCalendar::setFirstDayOfWeek() basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
var_dump(

View file

@ -20,14 +20,8 @@ try {
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_set_first_day_of_week(1, 2));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
IntlCalendar::setFirstDayOfWeek(): Argument #1 ($dayOfWeek) must be a valid day of the week
intlcal_set_first_day_of_week(): Argument #2 ($dayOfWeek) must be a valid day of the week
intlcal_set_first_day_of_week(): Argument #1 ($calendar) must be of type IntlCalendar, int given

View file

@ -1,18 +0,0 @@
--TEST--
IntlCalendar::setLenient(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
var_dump(intlcal_set_lenient(1, false));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: intlcal_set_lenient(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_set_lenient(1, false)
#1 {main}
thrown in %s on line %d

View file

@ -4,8 +4,6 @@ IntlCalendar::setMinimalDaysInFirstWeek() basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
var_dump(

View file

@ -1,7 +1,5 @@
--TEST--
IntlCalendar::setMinimalDaysInFirstWeek(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
@ -20,14 +18,8 @@ try {
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_set_minimal_days_in_first_week(1, 2));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
IntlCalendar::setMinimalDaysInFirstWeek(): Argument #1 ($days) must be between 1 and 7
intlcal_set_minimal_days_in_first_week(): Argument #2 ($days) must be between 1 and 7
intlcal_set_minimal_days_in_first_week(): Argument #1 ($calendar) must be of type IntlCalendar, int given

View file

@ -1,12 +1,9 @@
--TEST--
IntlCalendar::setSkipped/RepeatedWallTimeOption(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
@ -21,13 +18,7 @@ try {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(intlcal_set_repeated_wall_time_option(1, 1));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
IntlCalendar::setSkippedWallTimeOption(): Argument #1 ($option) must be one of IntlCalendar::WALLTIME_FIRST, IntlCalendar::WALLTIME_LAST, or IntlCalendar::WALLTIME_NEXT_VALID
IntlCalendar::setRepeatedWallTimeOption(): Argument #1 ($option) must be either IntlCalendar::WALLTIME_FIRST or IntlCalendar::WALLTIME_LAST
intlcal_set_repeated_wall_time_option(): Argument #1 ($calendar) must be of type IntlCalendar, int given

View file

@ -4,8 +4,6 @@ IntlCalendar::setTimeZone() basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('Europe/Amsterdam');
print_r($intlcal->getTimeZone()->getID());

View file

@ -1,49 +0,0 @@
--TEST--
IntlCalendar::setTimeZone(): bad arguments
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
$gmt = IntlTimeZone::getGMT();
function eh($errno, $errstr) {
echo "error: $errno, $errstr\n";
}
set_error_handler('eh');
try {
var_dump($c->setTimeZone($gmt, 2));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
var_dump($c->setTimeZone());
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try{
var_dump(intlcal_set_time_zone($c, 1, 2));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try{
var_dump(intlcal_set_time_zone(1, $gmt));
} catch (Error $ex) {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
?>
--EXPECT--
error: 0, IntlCalendar::setTimeZone() expects exactly 1 argument, 2 given
error: 0, IntlCalendar::setTimeZone() expects exactly 1 argument, 0 given
error: 0, intlcal_set_time_zone() expects exactly 2 arguments, 3 given
error: 0, intlcal_set_time_zone(): Argument #1 ($calendar) must be of type IntlCalendar, int given

View file

@ -2,25 +2,28 @@
IntlCalendar::setTimeZone(): valid time zones for DateTime but not ICU
--EXTENSIONS--
intl
--INI--
date.timezone=Europe/Amsterdam
intl.default_locale=nl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
date_default_timezone_set('Europe/Amsterdam');
$intlcal = new IntlGregorianCalendar();
$pstdate = new DateTime('2012-01-01 00:00:00 WEST');
$intlcal->setTimeZone($pstdate->getTimeZone());
var_dump($intlcal->setTimeZone($pstdate->getTimeZone()));
var_dump($intlcal->getErrorMessage());
var_dump($intlcal->getTimeZone()->getID());
$pstdate = new DateTime('2012-01-01 00:00:00 +24:00');
$intlcal->setTimeZone($pstdate->getTimeZone());
var_dump($intlcal->setTimeZone($pstdate->getTimeZone()));
var_dump($intlcal->getErrorMessage());
var_dump($intlcal->getTimeZone()->getID());
?>
--EXPECTF--
Warning: IntlCalendar::setTimeZone(): time zone id 'WEST' extracted from ext/date DateTimeZone not recognized in %s on line %d
--EXPECT--
bool(false)
string(126) "IntlCalendar::setTimeZone(): time zone id 'WEST' extracted from ext/date DateTimeZone not recognized: U_ILLEGAL_ARGUMENT_ERROR"
string(16) "Europe/Amsterdam"
Warning: IntlCalendar::setTimeZone(): object has an time zone offset that's too large in %s on line %d
bool(false)
string(102) "IntlCalendar::setTimeZone(): object has an time zone offset that's too large: U_ILLEGAL_ARGUMENT_ERROR"
string(16) "Europe/Amsterdam"

View file

@ -4,8 +4,6 @@ IntlCalendar::setTimeZone() variation with NULL arg
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('Europe/Amsterdam');
print_r($intlcal->getTimeZone()->getID());

View file

@ -4,9 +4,6 @@ IntlCalendar::setTimeZone(): different ways to specify time zone
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
date_default_timezone_set('Europe/Amsterdam');
$intlcal = new IntlGregorianCalendar();
$intlcal->setTimeZone('Europe/Paris');

View file

@ -1,13 +1,9 @@
--TEST--
IntlCalendar::setTime() basic test
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$time = strtotime('2012-02-29 00:00:00 +0000');

Some files were not shown because too many files have changed in this diff Show more