resourcebundle_create.phpt 1.3 KB

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