1--TEST--
2IntlCalendar::getErrorCode(), ::getErrorMessage() basic test
3--INI--
4date.timezone=Atlantic/Azores
5--SKIPIF--
6<?php
7if (!extension_loaded('intl'))
8    die('skip intl extension not enabled');
9--FILE--
10<?php
11ini_set("intl.error_level", E_WARNING);
12ini_set("intl.default_locale", "nl");
13
14$intlcal = new IntlGregorianCalendar(2012, 1, 29);
15var_dump(
16        $intlcal->getErrorCode(),
17        intlcal_get_error_code($intlcal),
18        $intlcal->getErrorMessage(),
19        intlcal_get_error_message($intlcal)
20);
21$intlcal->add(IntlCalendar::FIELD_SECOND, 2147483647);
22$intlcal->fieldDifference(-PHP_INT_MAX, IntlCalendar::FIELD_SECOND);
23
24var_dump(
25        $intlcal->getErrorCode(),
26        intlcal_get_error_code($intlcal),
27        $intlcal->getErrorMessage(),
28        intlcal_get_error_message($intlcal)
29);
30?>
31--EXPECTF--
32int(0)
33int(0)
34string(12) "U_ZERO_ERROR"
35string(12) "U_ZERO_ERROR"
36
37Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: Call to ICU method has failed in %s on line %d
38int(1)
39int(1)
40string(81) "intlcal_field_difference: Call to ICU method has failed: U_ILLEGAL_ARGUMENT_ERROR"
41string(81) "intlcal_field_difference: Call to ICU method has failed: U_ILLEGAL_ARGUMENT_ERROR"
42