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