summaryrefslogtreecommitdiff
path: root/ext/intl/tests/resourcebundle_create.phpt
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/intl/tests/resourcebundle_create.phpt
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/intl/tests/resourcebundle_create.phpt')
-rw-r--r--ext/intl/tests/resourcebundle_create.phpt62
1 files changed, 62 insertions, 0 deletions
diff --git a/ext/intl/tests/resourcebundle_create.phpt b/ext/intl/tests/resourcebundle_create.phpt
new file mode 100644
index 0000000..2bf4f55
--- /dev/null
+++ b/ext/intl/tests/resourcebundle_create.phpt
@@ -0,0 +1,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