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/DateTime_data-dates.inc | |
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/DateTime_data-dates.inc')
-rw-r--r-- | ext/date/tests/DateTime_data-dates.inc | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/ext/date/tests/DateTime_data-dates.inc b/ext/date/tests/DateTime_data-dates.inc new file mode 100644 index 0000000..c6f04e1 --- /dev/null +++ b/ext/date/tests/DateTime_data-dates.inc @@ -0,0 +1,66 @@ +<?php + +/* + * Note: test names match method names in a set of PHPUnit tests + * in a userland package. Please be so kind as to leave them. + */ + +date_default_timezone_set('America/New_York'); + + +/* + * Particular days + */ +echo "test__7: "; +examine_diff('2009-01-14', '2009-01-07', 'P+0Y0M7DT0H0M0S', 7); + +echo "test_years_positive__7_by_0_day: "; +examine_diff('2007-02-07', '2000-02-07', 'P+7Y0M0DT0H0M0S', 2557); + +echo "test_years_positive__7_by_1_day: "; +examine_diff('2007-02-08', '2000-02-07', 'P+7Y0M1DT0H0M0S', 2558); + +// NOTE: sub() produces different answer. +echo "test_years_positive__6_shy_1_day: "; +examine_diff('2007-02-06', '2000-02-07', 'P+6Y11M30DT0H0M0S', 2556); + +echo "test_years_positive__7_by_1_month: "; +examine_diff('2007-03-07', '2000-02-07', 'P+7Y1M0DT0H0M0S', 2585); + +echo "test_years_positive__6_shy_1_month: "; +examine_diff('2007-01-07', '2000-02-07', 'P+6Y11M0DT0H0M0S', 2526); + +echo "test_years_positive__7_by_1_month_split_newyear: "; +examine_diff('2007-01-07', '1999-12-07', 'P+7Y1M0DT0H0M0S', 2588); + +echo "test_years_positive__6_shy_1_month_split_newyear: "; +examine_diff('2006-12-07', '2000-01-07', 'P+6Y11M0DT0H0M0S', 2526); + + +/* + * Particular days, negative + */ +echo "test_negative__7: "; +examine_diff('2009-01-07', '2009-01-14', 'P-0Y0M7DT0H0M0S', 7); + +echo "test_years_negative__7_by_0_day: "; +examine_diff('2000-02-07', '2007-02-07', 'P-7Y0M0DT0H0M0S', 2557); + +echo "test_years_negative__7_by_1_day: "; +examine_diff('2000-02-07', '2007-02-08', 'P-7Y0M1DT0H0M0S', 2558); + +// NOTE: sub() produces different answer. +echo "test_years_negative__6_shy_1_day: "; +examine_diff('2000-02-07', '2007-02-06', 'P-6Y11M28DT0H0M0S', 2556); + +echo "test_years_negative__7_by_1_month: "; +examine_diff('2000-02-07', '2007-03-07', 'P-7Y1M0DT0H0M0S', 2585); + +echo "test_years_negative__6_shy_1_month: "; +examine_diff('2000-02-07', '2007-01-07', 'P-6Y11M0DT0H0M0S', 2526); + +echo "test_years_negative__7_by_1_month_split_newyear: "; +examine_diff('1999-12-07', '2007-01-07', 'P-7Y1M0DT0H0M0S', 2588); + +echo "test_years_negative__6_shy_1_month_split_newyear: "; +examine_diff('2000-01-07', '2006-12-07', 'P-6Y11M0DT0H0M0S', 2526); |