diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
|---|---|---|
| committer | <> | 2013-04-03 16:25:08 +0000 |
| commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
| tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/date/tests/date-lenient-create.phpt | |
| download | php2-master.tar.gz | |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/date/tests/date-lenient-create.phpt')
| -rw-r--r-- | ext/date/tests/date-lenient-create.phpt | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/ext/date/tests/date-lenient-create.phpt b/ext/date/tests/date-lenient-create.phpt new file mode 100644 index 0000000..49ee3c1 --- /dev/null +++ b/ext/date/tests/date-lenient-create.phpt @@ -0,0 +1,149 @@ +--TEST-- +Test for + character in date format +--FILE-- +<?php +$tz = new DateTimeZone("UTC"); +$date = "06/08/04 12:00"; +echo "==\n"; +print_r( date_create_from_format( 'm/d/y', $date , $tz) ); +print_r( date_get_last_errors() ); +echo "==\n"; +print_r( date_create_from_format( 'm/d/y+', $date , $tz)->setTime(0, 0) ); +print_r( date_get_last_errors() ); +echo "==\n"; +print_r( date_create_from_format( '+m/d/y', $date , $tz)->setTime(0, 0) ); +print_r( date_get_last_errors() ); +echo "==\n"; +print_r( date_create_from_format( 'm/d/y++', $date , $tz)->setTime(0, 0) ); +print_r( date_get_last_errors() ); +echo "==\n"; + +$date = "06/08/04"; +print_r( date_create_from_format( 'm/d/y+', $date , $tz)->setTime(0, 0) ); +print_r( date_get_last_errors() ); +echo "==\n"; +print_r( date_create_from_format( '+m/d/y', $date , $tz)->setTime(0, 0) ); +print_r( date_get_last_errors() ); +echo "==\n"; + +?> +--EXPECT-- +== +Array +( + [warning_count] => 0 + [warnings] => Array + ( + ) + + [error_count] => 1 + [errors] => Array + ( + [8] => Trailing data + ) + +) +== +DateTime Object +( + [date] => 2004-06-08 00:00:00 + [timezone_type] => 3 + [timezone] => UTC +) +Array +( + [warning_count] => 1 + [warnings] => Array + ( + [8] => Trailing data + ) + + [error_count] => 0 + [errors] => Array + ( + ) + +) +== +DateTime Object +( + [date] => 2004-06-08 00:00:00 + [timezone_type] => 3 + [timezone] => UTC +) +Array +( + [warning_count] => 1 + [warnings] => Array + ( + [8] => Trailing data + ) + + [error_count] => 0 + [errors] => Array + ( + ) + +) +== +DateTime Object +( + [date] => 2004-06-08 00:00:00 + [timezone_type] => 3 + [timezone] => UTC +) +Array +( + [warning_count] => 1 + [warnings] => Array + ( + [8] => Trailing data + ) + + [error_count] => 0 + [errors] => Array + ( + ) + +) +== +DateTime Object +( + [date] => 2004-06-08 00:00:00 + [timezone_type] => 3 + [timezone] => UTC +) +Array +( + [warning_count] => 0 + [warnings] => Array + ( + ) + + [error_count] => 0 + [errors] => Array + ( + ) + +) +== +DateTime Object +( + [date] => 2004-06-08 00:00:00 + [timezone_type] => 3 + [timezone] => UTC +) +Array +( + [warning_count] => 0 + [warnings] => Array + ( + ) + + [error_count] => 0 + [errors] => Array + ( + ) + +) +== |
