php-src/ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt
Nikita Popov 7485978339
Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +02:00

34 lines
806 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(): intltz_get_offset: error obtaining offset in %s on line %d
bool(false)
int(1)
string(67) "intltz_get_offset: error obtaining offset: U_ILLEGAL_ARGUMENT_ERROR"