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