File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / intl / tests / resourcebundle_create.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:57 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>