PHP  
 PHP_7_2
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.phpt ('datefmt_parse_code() icu <= 4.2')

Script

1: <?php
2:
3:
/*
4:  * Test for the datefmt_parse  function
5:  */
6:
7:
putenv('TZ=America/Los_Angeles');
8:
9: function 
ut_main()
10: {
11:     
$locale_arr = array (
12:         
'en_US_CA'
13:     
);
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:
26:     
$text_arr = array (
27:         
// Full parsing
28:         
array("Sunday, September 18, 2039 4:06:40 PM PT"IntlDateFormatter::FULLIntlDateFormatter::FULL),
29:         array(
"Wednesday, December 17, 1969 6:40:00 PM PT"IntlDateFormatter::FULLIntlDateFormatter::FULL),
30:         array(
"Thursday, December 18, 1969 8:49:59 PM PST"IntlDateFormatter::FULLIntlDateFormatter::FULL),
31:         array(
"December 18, 1969 8:49:59 AM PST"IntlDateFormatter::LONGIntlDateFormatter::FULL),
32:         array(
"12/18/69 8:49 AM"IntlDateFormatter::SHORTIntlDateFormatter::SHORT),
33:         array(
"19691218 08:49 AM"IntlDateFormatter::SHORTIntlDateFormatter::SHORT),
34:         
// Partial parsing
35:         
array("Sunday, September 18, 2039 4:06:40 PM PT"IntlDateFormatter::FULLIntlDateFormatter::NONE),
36:         array(
"Sunday, September 18, 2039 4:06:40 PM PT"IntlDateFormatter::FULLIntlDateFormatter::SHORT),
37:         array(
"December 18, 1969 8:49:59 AM PST"IntlDateFormatter::LONGIntlDateFormatter::NONE),
38:         array(
"December 18, 1969 8:49:59 AM PST"IntlDateFormatter::LONGIntlDateFormatter::SHORT),
39:         array(
"12/18/69 8:49 AM"IntlDateFormatter::SHORTIntlDateFormatter::LONG),
40:         array(
"19691218 08:49 AM"IntlDateFormatter::SHORTIntlDateFormatter::LONG),
41:     );
42:
43:     foreach( 
$text_arr as $text_entry){
44:         
$fmt ut_datefmt_create'en_US_CA'$text_entry[1], $text_entry[2]);
45:         
$parse_pos 0;
46:         
$parsed ut_datefmt_parse$fmt $text_entry[0] , $parse_pos );
47:
48:         
$res_str .= "\nInput text : {$text_entry[0]} ; DF = {$text_entry[1]}; TF = {$text_entry[2]}";
49:         if( 
intl_get_error_code() != U_ZERO_ERROR) {
50:             
$res_str .= "\nError : ".intl_get_error_message();
51:         }
52:         
$res_str .= "\nParsed: $parsed; parse_pos : $parse_pos\n";
53:     }
54:
55:     return 
$res_str;
56:
57: }
58:
59: include_once( 
'ut_common.inc' );
60:
61:
// Run the test
62:
ut_run();
63:
?>
64:

Expected

Input text : Sunday, September 18, 2039 4:06:40 PM PT ; DF = 0; TF = 0
Parsed: 2200000000; parse_pos : 40

Input text : Wednesday, December 17, 1969 6:40:00 PM PT ; DF = 0; TF = 0
Parsed: -1200000; parse_pos : 42

Input text : Thursday, December 18, 1969 8:49:59 PM PST ; DF = 0; TF = 0
Parsed: -1105801; parse_pos : 42

Input text : December 18, 1969 8:49:59 AM PST ; DF = 1; TF = 0
Parsed: -1149001; parse_pos : 32

Input text : 12/18/69 8:49 AM ; DF = 3; TF = 3
Parsed: -1149060; parse_pos : 16

Input text : 19691218 08:49 AM ; DF = 3; TF = 3
Error : Date parsing failed: U_PARSE_ERROR
Parsed: ; parse_pos : 8

Input text : Sunday, September 18, 2039 4:06:40 PM PT ; DF = 0; TF = -1
Parsed: 2199942000; parse_pos : 26

Input text : Sunday, September 18, 2039 4:06:40 PM PT ; DF = 0; TF = 3
Error : Date parsing failed: U_PARSE_ERROR
Parsed: ; parse_pos : 31

Input text : December 18, 1969 8:49:59 AM PST ; DF = 1; TF = -1
Parsed: -1180800; parse_pos : 17

Input text : December 18, 1969 8:49:59 AM PST ; DF = 1; TF = 3
Error : Date parsing failed: U_PARSE_ERROR
Parsed: ; parse_pos : 22

Input text : 12/18/69 8:49 AM ; DF = 3; TF = 1
Error : Date parsing failed: U_PARSE_ERROR
Parsed: ; parse_pos : 13

Input text : 19691218 08:49 AM ; DF = 3; TF = 1
Error : Date parsing failed: U_PARSE_ERROR
Parsed: ; parse_pos : 8

Output

Input text : Sunday, September 18, 2039 4:06:40 PM PT ; DF = 0; TF = 0
Parsed: 2200000000; parse_pos : 0

Input text : Wednesday, December 17, 1969 6:40:00 PM PT ; DF = 0; TF = 0
Parsed: -1200000; parse_pos : 0

Input text : Thursday, December 18, 1969 8:49:59 PM PST ; DF = 0; TF = 0
Parsed: -1105801; parse_pos : 0

Input text : December 18, 1969 8:49:59 AM PST ; DF = 1; TF = 0
Parsed: -1149001; parse_pos : 0

Input text : 12/18/69 8:49 AM ; DF = 3; TF = 3
Parsed: -1149060; parse_pos : 0

Input text : 19691218 08:49 AM ; DF = 3; TF = 3
Error : Date parsing failed: U_PARSE_ERROR
Parsed: ; parse_pos : 0

Input text : Sunday, September 18, 2039 4:06:40 PM PT ; DF = 0; TF = -1
Parsed: 2199942000; parse_pos : 0

Input text : Sunday, September 18, 2039 4:06:40 PM PT ; DF = 0; TF = 3
Error : Date parsing failed: U_PARSE_ERROR
Parsed: ; parse_pos : 0

Input text : December 18, 1969 8:49:59 AM PST ; DF = 1; TF = -1
Parsed: -1180800; parse_pos : 0

Input text : December 18, 1969 8:49:59 AM PST ; DF = 1; TF = 3
Error : Date parsing failed: U_PARSE_ERROR
Parsed: ; parse_pos : 0

Input text : 12/18/69 8:49 AM ; DF = 3; TF = 1
Error : Date parsing failed: U_PARSE_ERROR
Parsed: ; parse_pos : 0

Input text : 19691218 08:49 AM ; DF = 3; TF = 1
Error : Date parsing failed: U_PARSE_ERROR
Parsed: ; parse_pos : 0

Diff

002+ Parsed: 2200000000; parse_pos : 0
002- Parsed: 2200000000; parse_pos : 40
005+ Parsed: -1200000; parse_pos : 0
005- Parsed: -1200000; parse_pos : 42
008+ Parsed: -1105801; parse_pos : 0
008- Parsed: -1105801; parse_pos : 42
011+ Parsed: -1149001; parse_pos : 0
011- Parsed: -1149001; parse_pos : 32
014+ Parsed: -1149060; parse_pos : 0
014- Parsed: -1149060; parse_pos : 16
018+ Parsed: ; parse_pos : 0
018- Parsed: ; parse_pos : 8
021+ Parsed: 2199942000; parse_pos : 0
021- Parsed: 2199942000; parse_pos : 26
025+ Parsed: ; parse_pos : 0
025- Parsed: ; parse_pos : 31
028+ Parsed: -1180800; parse_pos : 0
028- Parsed: -1180800; parse_pos : 17
032+ Parsed: ; parse_pos : 0
032- Parsed: ; parse_pos : 22
036+ Parsed: ; parse_pos : 0
036- Parsed: ; parse_pos : 13
040+ Parsed: ; parse_pos : 0
040- Parsed: ; parse_pos : 8

 

Generated at Sat, 16 Sep 2017 05:04:10 +0000 (10 days ago)

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