1--TEST--
2datefmt_get_datetype_code()
3--EXTENSIONS--
4intl
5--FILE--
6<?php
7
8/*
9 * Test for the datefmt_get_datetype  function
10 */
11
12
13function ut_main()
14{
15    $datetype_arr = array (
16        IntlDateFormatter::FULL,
17        IntlDateFormatter::LONG,
18        IntlDateFormatter::MEDIUM,
19        IntlDateFormatter::SHORT,
20        IntlDateFormatter::NONE
21    );
22
23    $res_str = '';
24
25    foreach( $datetype_arr as $datetype_entry )
26    {
27        $res_str .= "\nCreating IntlDateFormatter with date_type = $datetype_entry";
28        $fmt = ut_datefmt_create( "de-DE",  $datetype_entry , IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN  );
29        $date_type = ut_datefmt_get_datetype( $fmt);
30        $res_str .= "\nAfter call to get_datetype :  datetype= $date_type";
31        $res_str .= "\n";
32    }
33
34    return $res_str;
35
36}
37
38include_once( 'ut_common.inc' );
39
40// Run the test
41ut_run();
42?>
43--EXPECT--
44Creating IntlDateFormatter with date_type = 0
45After call to get_datetype :  datetype= 0
46
47Creating IntlDateFormatter with date_type = 1
48After call to get_datetype :  datetype= 1
49
50Creating IntlDateFormatter with date_type = 2
51After call to get_datetype :  datetype= 2
52
53Creating IntlDateFormatter with date_type = 3
54After call to get_datetype :  datetype= 3
55
56Creating IntlDateFormatter with date_type = -1
57After call to get_datetype :  datetype= -1
58