Annotation of embedaddon/php/ext/intl/tests/collator_get_error_code.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: get_error_code()
3: --SKIPIF--
4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5: --FILE--
6: <?php
7:
8: /*
9: * Retreive error code.
10: */
11:
12:
13: /*
14: * Check if error code equals to expected one.
15: */
16: function check_rc( $rc, $expected )
17: {
18: return ( $rc === $expected ? "ok" : "failed" ) . "\n";
19: }
20:
21: function 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:
39: # Suppress warning messages.
40: error_reporting( E_ERROR );
41:
42: include_once( 'ut_common.inc' );
43: ut_run();
44: ?>
45: --EXPECT--
46: ok
47: ok
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>