1--TEST-- 2datefmt_set_lenient and datefmt_set_lenient() 3--SKIPIF-- 4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> 5--FILE-- 6 7<?php 8 9/* 10 * Test for the datefmt_get_lenient & datefmt_set_lenient function 11 */ 12 13 14function ut_main() 15{ 16 17 $res_str = ''; 18 19 //Create 20 $fmt = ut_datefmt_create( "en-US", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT , 'America/New_York', IntlDateFormatter::GREGORIAN ); 21 $res_str .= "\nIntlDateFormatter Created.\n"; 22 23 $resLenient1 = ut_datefmt_is_lenient( $fmt); 24 $res_str .= "After call to get_lenient : lenient= "; 25 if( $resLenient1){ 26 $res_str .= "TRUE\n"; 27 }else{ 28 $res_str .= "FALSE\n"; 29 } 30 31 //Set and test 32 $res_str .= "--------------------\n"; 33 $isLenient = TRUE; 34 $res_str .= "Setting IntlDateFormatter with lenient = "; 35 if( $isLenient){ 36 $res_str .= "TRUE\n"; 37 }else{ 38 $res_str .= "FALSE\n"; 39 } 40 ut_datefmt_set_lenient( $fmt , $isLenient ); 41 $resLenient = ut_datefmt_is_lenient( $fmt); 42 $res_str .= "After call to is_lenient : lenient= "; 43 if( $resLenient){ 44 $res_str .= "TRUE\n"; 45 }else{ 46 $res_str .= "FALSE\n"; 47 } 48 49 50 //Set and test 51 $res_str .= "--------------------\n"; 52 $isLenient = FALSE; 53 $res_str .= "Setting IntlDateFormatter with lenient ="; 54 if( $isLenient){ 55 $res_str .= "TRUE\n"; 56 }else{ 57 $res_str .= "FALSE\n"; 58 } 59 ut_datefmt_set_lenient( $fmt , $isLenient); 60 $resLenient = ut_datefmt_is_lenient( $fmt); 61 $res_str .= "After call to is_lenient : lenient= "; 62 if( $resLenient){ 63 $res_str .= "TRUE\n"; 64 }else{ 65 $res_str .= "FALSE\n"; 66 } 67 68 $res_str .= "--------------------\n"; 69 70 return $res_str; 71 72} 73 74include_once( 'ut_common.inc' ); 75 76// Run the test 77ut_run(); 78?> 79--EXPECT-- 80IntlDateFormatter Created. 81After call to get_lenient : lenient= TRUE 82-------------------- 83Setting IntlDateFormatter with lenient = TRUE 84After call to is_lenient : lenient= TRUE 85-------------------- 86Setting IntlDateFormatter with lenient =FALSE 87After call to is_lenient : lenient= FALSE 88-------------------- 89