Annotation of embedaddon/php/ext/intl/tests/resourcebundle_individual.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test ResourceBundle::get() and length() - existing/missing keys
! 3: --SKIPIF--
! 4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
! 5: --FILE--
! 6: <?php
! 7: include "resourcebundle.inc";
! 8:
! 9: function ut_main() {
! 10: $str_res = '';
! 11: // fall back
! 12: $r = ut_resourcebundle_create( 'en_US', BUNDLE );
! 13:
! 14: $str_res .= sprintf( "length: %d\n", ut_resourcebundle_count($r) );
! 15: $str_res .= sprintf( "teststring: %s\n", ut_resourcebundle_get($r, 'teststring' ) );
! 16: $str_res .= sprintf( "testint: %d\n", ut_resourcebundle_get($r, 'testint' ) );
! 17:
! 18: $str_res .= print_r( ut_resourcebundle_get($r, 'testvector' ), true );
! 19:
! 20: $str_res .= sprintf( "testbin: %s\n", bin2hex(ut_resourcebundle_get( $r,'testbin' )) );
! 21:
! 22: $r2 = ut_resourcebundle_get($r, 'testtable' );
! 23: $str_res .= sprintf( "testtable: %d\n", ut_resourcebundle_get($r2, 'major' ) );
! 24:
! 25: $r2 = ut_resourcebundle_get($r,'testarray' );
! 26: $str_res .= sprintf( "testarray: %s\n", ut_resourcebundle_get($r2, 2 ) );
! 27:
! 28: $t = ut_resourcebundle_get( $r, 'nonexisting' );
! 29: $str_res .= debug( $t );
! 30:
! 31: return $str_res;
! 32: }
! 33: include_once( 'ut_common.inc' );
! 34: ut_run();
! 35: ?>
! 36: --EXPECT--
! 37: length: 6
! 38: teststring: Hello World!
! 39: testint: 2
! 40: Array
! 41: (
! 42: [0] => 1
! 43: [1] => 2
! 44: [2] => 3
! 45: [3] => 4
! 46: [4] => 5
! 47: [5] => 6
! 48: [6] => 7
! 49: [7] => 8
! 50: [8] => 9
! 51: [9] => 0
! 52: )
! 53: testbin: a1b2c3d4e5f67890
! 54: testtable: 3
! 55: testarray: string 3
! 56: NULL
! 57: 2: Cannot load resource element 'nonexisting': U_MISSING_RESOURCE_ERROR
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>