1--TEST--
2Test ResourceBundle::get() and length() - existing/missing keys
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5--FILE--
6<?php
7	include "resourcebundle.inc";
8
9function ut_main() {
10	$str_res = '';
11	// fall back
12	$r = ut_resourcebundle_create( 'en_US', BUNDLE );
13
14	$str_res .= sprintf( "length: %d\n", ut_resourcebundle_count($r) );
15	$str_res .= sprintf( "teststring: %s\n", ut_resourcebundle_get($r,  'teststring' ) );
16	$str_res .= sprintf( "testint: %d\n", ut_resourcebundle_get($r, 'testint' ) );
17
18	$str_res .= print_r( ut_resourcebundle_get($r, 'testvector' ), true );
19
20	$str_res .= sprintf( "testbin: %s\n", bin2hex(ut_resourcebundle_get( $r,'testbin' )) );
21
22	$r2 = ut_resourcebundle_get($r, 'testtable' );
23	$str_res .= sprintf( "testtable: %d\n", ut_resourcebundle_get($r2, 'major' ) );
24
25	$r2 = ut_resourcebundle_get($r,'testarray' );
26	$str_res .= sprintf( "testarray: %s\n", ut_resourcebundle_get($r2, 2 ) );
27
28	$t = ut_resourcebundle_get( $r, 'nonexisting' );
29	$str_res .= debug( $t );
30
31	return $str_res;
32}
33	include_once( 'ut_common.inc' );
34	ut_run();
35?>
36--EXPECT--
37length: 6
38teststring: Hello World!
39testint: 2
40Array
41(
42    [0] => 1
43    [1] => 2
44    [2] => 3
45    [3] => 4
46    [4] => 5
47    [5] => 6
48    [6] => 7
49    [7] => 8
50    [8] => 9
51    [9] => 0
52)
53testbin: a1b2c3d4e5f67890
54testtable: 3
55testarray: string 3
56NULL
57    2: Cannot load resource element 'nonexisting': U_MISSING_RESOURCE_ERROR
58