PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt ('datefmt_parse_timestamp_code() with parse pos icu <= 4.2')

Script

1: <?php
2:
3:
/*
4:  * Test for the datefmt_parse_timestamp  function with parse_pos
5:  */
6:
7:
8:
function ut_main()
9: {
10:     
$locale_arr = array (
11:         
'en_US_CA'
12:     
);
13:
14:     
$datetype_arr = array (
15:                 
IntlDateFormatter::FULL,
16:                 
IntlDateFormatter::LONG,
17:                 
IntlDateFormatter::MEDIUM,
18:                 
IntlDateFormatter::SHORT,
19:                 
IntlDateFormatter::NONE
20:         
);
21:
22:         
$res_str '';
23:
24:
25:     
$text_arr = array (
26:         
"Sunday, September 18, 3039 4:06:40 PM PT",
27:         
"Thursday, December 18, 1969 8:49:59 AM PST",
28:         
//"December 18, 1969 8:49:59 AM PST",
29:         
"12/18/69 8:49 AM",
30:         
"20111218 08:49 AM",
31:         
"19691218 08:49 AM"
32:     
);
33:
34:     foreach( 
$text_arr as $text_entry){
35:                 
$res_str .= "\n------------\n";
36:                 
$res_str .= "\nInput text is : $text_entry";
37:                 
$res_str .= "\n------------";
38:
39:                 foreach( 
$locale_arr as $locale_entry ){
40:             
$res_str .= "\nLocale is : $locale_entry";
41:             
$res_str .= "\n------------";
42:                         foreach( 
$datetype_arr as $datetype_entry )
43:             {
44:                 
$res_str .= "\ndatetype = $datetype_entry ,timetype =$datetype_entry";
45:                 
$fmt ut_datefmt_create$locale_entry $datetype_entry ,$datetype_entry);
46:                 
$pos 0;
47:                 
$parsed ut_datefmt_parse$fmt $text_entry$pos);
48:                 if( 
intl_get_error_code() == U_ZERO_ERROR){
49:                     
$res_str .= "\nParsed text is : $parsed; Position = $pos";
50:                 }else{
51:                     
$res_str .= "\nError while parsing as: '".intl_get_error_message()."'; Position = $pos";
52:                 }
53:             }
54:         }
55:         }
56:     
$res_str .= "\n";
57:
58:     return 
$res_str;
59:
60: }
61:
62: include_once( 
'ut_common.inc' );
63:
64:
// Run the test
65:
ut_run();
66:
?>
67:

Expected

------------

Input text is : Sunday, September 18, 3039 4:06:40 PM PT
------------
Locale is : en_US_CA
------------
datetype = 0 ,timetype =0
Parsed text is : 33756908800; Position = 40
datetype = 1 ,timetype =1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 2 ,timetype =2
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 3 ,timetype =3
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = -1 ,timetype =-1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
------------

Input text is : Thursday, December 18, 1969 8:49:59 AM PST
------------
Locale is : en_US_CA
------------
datetype = 0 ,timetype =0
Parsed text is : -1149001; Position = 42
datetype = 1 ,timetype =1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 2 ,timetype =2
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 3 ,timetype =3
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = -1 ,timetype =-1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
------------

Input text is : 12/18/69 8:49 AM
------------
Locale is : en_US_CA
------------
datetype = 0 ,timetype =0
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 1 ,timetype =1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 2 ,timetype =2
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 3 ,timetype =3
Parsed text is : -1149060; Position = 16
datetype = -1 ,timetype =-1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
------------

Input text is : 20111218 08:49 AM
------------
Locale is : en_US_CA
------------
datetype = 0 ,timetype =0
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 1 ,timetype =1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 2 ,timetype =2
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 3 ,timetype =3
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 8
datetype = -1 ,timetype =-1
Parsed text is : 1324226940; Position = 17
------------

Input text is : 19691218 08:49 AM
------------
Locale is : en_US_CA
------------
datetype = 0 ,timetype =0
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 1 ,timetype =1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 2 ,timetype =2
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 3 ,timetype =3
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 8
datetype = -1 ,timetype =-1
Parsed text is : -1149060; Position = 17

Output

------------

Input text is : Sunday, September 18, 3039 4:06:40 PM PT
------------
Locale is : en_US_CA
------------
datetype = 0 ,timetype =0
Parsed text is : 33756908800; Position = 0
datetype = 1 ,timetype =1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 2 ,timetype =2
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 3 ,timetype =3
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = -1 ,timetype =-1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
------------

Input text is : Thursday, December 18, 1969 8:49:59 AM PST
------------
Locale is : en_US_CA
------------
datetype = 0 ,timetype =0
Parsed text is : -1149001; Position = 0
datetype = 1 ,timetype =1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 2 ,timetype =2
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 3 ,timetype =3
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = -1 ,timetype =-1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
------------

Input text is : 12/18/69 8:49 AM
------------
Locale is : en_US_CA
------------
datetype = 0 ,timetype =0
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 1 ,timetype =1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 2 ,timetype =2
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 3 ,timetype =3
Parsed text is : -1149060; Position = 0
datetype = -1 ,timetype =-1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
------------

Input text is : 20111218 08:49 AM
------------
Locale is : en_US_CA
------------
datetype = 0 ,timetype =0
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 1 ,timetype =1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 2 ,timetype =2
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 3 ,timetype =3
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = -1 ,timetype =-1
Parsed text is : 1324226940; Position = 0
------------

Input text is : 19691218 08:49 AM
------------
Locale is : en_US_CA
------------
datetype = 0 ,timetype =0
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 1 ,timetype =1
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 2 ,timetype =2
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = 3 ,timetype =3
Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
datetype = -1 ,timetype =-1
Parsed text is : -1149060; Position = 0

Diff

008+ Parsed text is : 33756908800; Position = 0
008- Parsed text is : 33756908800; Position = 40
024+ Parsed text is : -1149001; Position = 0
024- Parsed text is : -1149001; Position = 42
046+ Parsed text is : -1149060; Position = 0
046- Parsed text is : -1149060; Position = 16
062+ Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
062- Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 8
064+ Parsed text is : 1324226940; Position = 0
064- Parsed text is : 1324226940; Position = 17
078+ Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 0
078- Error while parsing as: 'Date parsing failed: U_PARSE_ERROR'; Position = 8
080+ Parsed text is : -1149060; Position = 0
080- Parsed text is : -1149060; Position = 17

 

Generated at Fri, 21 Jul 2017 05:20:59 +0000 (3 days ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.