summaryrefslogtreecommitdiff
path: root/ext/intl/tests/resourcebundle_create.phpt
blob: 1a1ba8e03f04c0a93c88b43d3cba24f5913f7247 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
--TEST--
Test ResourceBundle::__construct() - existing/missing bundles/locales
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php

include "resourcebundle.inc";

function ut_main() {
	$str_res = '';
	// all fine
	$r1 = ut_resourcebundle_create( 'root', BUNDLE );
	$str_res .= debug( $r1 );
	$str_res .= print_r( $r1['teststring'], true)."\n";

	// non-root one
	$r1 = ut_resourcebundle_create( 'es', BUNDLE );
	$str_res .= debug( $r1 );
	$str_res .= print_r( $r1['teststring'], true)."\n";

	// fall back
	$r1 = ut_resourcebundle_create( 'en_US', BUNDLE );
        $str_res .= debug( $r1 );
	$str_res .= print_r( $r1['testsring'], true);

	// fall out
	$r2 = ut_resourcebundle_create( 'en_US', BUNDLE, false );
        $str_res .= debug( $r2 );

	// missing
	$r3 = ut_resourcebundle_create( 'en_US', 'nonexisting' );
        $str_res .= debug( $r3 );

	return $str_res;
}

	include_once( 'ut_common.inc' );
	ut_run();
?>
--EXPECTF--
ResourceBundle Object
(
)

    0: U_ZERO_ERROR
Hello World!
ResourceBundle Object
(
)

    0: U_ZERO_ERROR
Hola Mundo!
ResourceBundle Object
(
)

 -127: U_USING_DEFAULT_WARNING
NULL
    2: resourcebundle_ctor: Cannot load libICU resource bundle: U_MISSING_RESOURCE_ERROR
NULL
    2: resourcebundle_ctor: Cannot load libICU resource bundle: U_MISSING_RESOURCE_ERROR