1--TEST--
2get_error_code()
3--EXTENSIONS--
4intl
5--FILE--
6<?php
7
8/*
9 * Retrieve error code.
10 */
11
12
13/*
14 * Check if error code equals to expected one.
15 */
16function check_rc( $rc, $expected )
17{
18    return ( $rc === $expected ? "ok" : "failed" ) . "\n";
19}
20
21function ut_main()
22{
23    $res = '';
24    $coll = ut_coll_create( 'ru_RU' );
25
26    // Try specifying a correct attribute.
27    ut_coll_get_attribute( $coll, Collator::NORMALIZATION_MODE );
28    $status = ut_coll_get_error_code( $coll );
29    $res .= check_rc( $status, U_ZERO_ERROR );
30
31    // Try specifying an incorrect attribute.
32    ut_coll_get_attribute( $coll, 12345 );
33    $status = ut_coll_get_error_code( $coll );
34    $res .= check_rc( $status, U_ILLEGAL_ARGUMENT_ERROR );
35
36    return $res;
37}
38
39include_once( 'ut_common.inc' );
40ut_run();
41?>
42--EXPECT--
43ok
44ok
45