Annotation of embedaddon/php/ext/intl/tests/msgfmt_clone.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Cloning msgfmt
! 3: --SKIPIF--
! 4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
! 5: --FILE--
! 6: <?php
! 7: include_once( 'ut_common.inc' );
! 8: $GLOBALS['oo-mode'] = true;
! 9: $res_str = '';
! 10: /*
! 11: * Clone
! 12: */
! 13: $fmt = ut_msgfmt_create( "en_US", "{0,number} monkeys on {1,number} trees" );
! 14:
! 15: // Get default patten.
! 16: $res_str .= "Formatting result: " . ut_msgfmt_format( $fmt, array(123, 456) ) . "\n";
! 17: $fmt_clone = clone $fmt;
! 18: // Set a new pattern.
! 19: $pattern = "{0,number} trees hosting {1,number} monkeys";
! 20: $res = ut_msgfmt_set_pattern( $fmt, $pattern );
! 21: $res_str .= "Formatting result: " . ut_msgfmt_format( $fmt, array(123, 456) ) . "\n";
! 22: $res_str .= "Formatting clone result: " . ut_msgfmt_format( $fmt_clone, array(123, 456) ) . "\n";
! 23:
! 24: echo $res_str;
! 25:
! 26: ?>
! 27: --EXPECTF--
! 28: Formatting result: 123 monkeys on 456 trees
! 29: Formatting result: 123 trees hosting 456 monkeys
! 30: Formatting clone result: 123 monkeys on 456 trees
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>