1--TEST--
2Test ResourceBundle::__construct() - existing/missing bundles/locales
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5--FILE--
6<?php
7
8include "resourcebundle.inc";
9
10function ut_main() {
11    $str_res = '';
12    // all fine
13    $r1 = ut_resourcebundle_create( 'root', BUNDLE );
14    $str_res .= debug( $r1 );
15    $str_res .= print_r( $r1['teststring'], true)."\n";
16
17    // non-root one
18    $r1 = ut_resourcebundle_create( 'es', BUNDLE );
19    $str_res .= debug( $r1 );
20    $str_res .= print_r( $r1['teststring'], true)."\n";
21
22    // fall back
23    $r1 = ut_resourcebundle_create( 'en_US', BUNDLE );
24        $str_res .= debug( $r1 );
25    $str_res .= print_r( $r1['testsring'], true);
26
27    // fall out
28    $r2 = ut_resourcebundle_create( 'en_US', BUNDLE, false );
29        $str_res .= debug( $r2 );
30
31    // missing
32    $r3 = ut_resourcebundle_create( 'en_US', 'nonexisting' );
33        $str_res .= debug( $r3 );
34
35    return $str_res;
36}
37
38    include_once( 'ut_common.inc' );
39    ut_run();
40?>
41--EXPECT--
42ResourceBundle Object
43(
44)
45
46    0: U_ZERO_ERROR
47Hello World!
48ResourceBundle Object
49(
50)
51
52    0: U_ZERO_ERROR
53Hola Mundo!
54ResourceBundle Object
55(
56)
57
58 -127: U_USING_DEFAULT_WARNING
59NULL
60    2: resourcebundle_ctor: Cannot load libICU resource bundle: U_MISSING_RESOURCE_ERROR
61NULL
62    2: resourcebundle_ctor: Cannot load libICU resource bundle: U_MISSING_RESOURCE_ERROR
63