php-src/ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt
David CARLIER 9a3a4b5ba2
ext/intl: IntlDateFormatter class removing redundant error message info. (#13465)
Also correcting new IntlChar class constants typos.
2024-02-21 23:23:09 +00:00

34 lines
768 B
PHP

--TEST--
IntlTimeZone::getErrorCode/Message(): basic test
--EXTENSIONS--
intl
--SKIPIF--
<?php
/* INF being an invalid offset depends on UB in float->int cast behavior. */
$arch = php_uname('m');
if ($arch != 'x86_64' && $arch != 'i386')
die('skip requires x86');
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$lsb = IntlTimeZone::createTimeZone('Europe/Lisbon');
var_dump($lsb->getErrorCode());
var_dump($lsb->getErrorMessage());
var_dump($lsb->getOffset(INF, 1, $a, $b));
var_dump($lsb->getErrorCode());
var_dump($lsb->getErrorMessage());
?>
--EXPECTF--
int(0)
string(12) "U_ZERO_ERROR"
Warning: IntlTimeZone::getOffset(): error obtaining offset in %s on line %d
bool(false)
int(1)
string(48) "error obtaining offset: U_ILLEGAL_ARGUMENT_ERROR"