derick Thu Jun 16 13:35:08 2005 EDT
Added files:
/php-src/ext/date/tests 002-win32.phpt 002.phpt bug13142.phpt
bug17988.phpt bug20382.phpt bug26198.phpt
bug26317.phpt bug26320.phpt bug27780.phpt
bug28599.phpt
Removed files:
/php-src/ext/standard/tests/time 002-win32.phpt 002.phpt
bug13142.phpt bug17988.phpt
bug20382.phpt bug26198.phpt
bug26317.phpt bug26320.phpt
bug27780.phpt bug28599.phpt
Log:
- Move strtotime() related testcases to ext/date/tests.
http://cvs.php.net/co.php/php-src/ext/date/tests/002-win32.phpt?r=1.1&p=1
Index: php-src/ext/date/tests/002-win32.phpt
+++ php-src/ext/date/tests/002-win32.phpt
--TEST--
strtotime() function
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
print 'skip test for win32 only';
}
if ([EMAIL PROTECTED]("TZ=GST-1GDT") || getenv("TZ") != 'GST-1GDT') {
die("skip unable to change TZ enviroment variable\n");
}
?>
--FILE--
<?php
$dates = array (
"1999-10-13",
"Oct 13 1999",
"2000-01-19",
"Jan 19 2000",
"2001-12-21",
"Dec 21 2001",
"2001-12-21 12:16",
"Dec 21 2001 12:16",
"2001-10-22 21:19:58",
"2001-10-22 21:19:58-02",
"2001-10-22 21:19:58-0213",
"2001-10-22 21:19:58+02",
"2001-10-22 21:19:58+0213"
);
putenv ("TZ=GMT");
foreach ($dates as $date) {
echo date("Y-m-d H:i:s\n", strtotime ($date));
}
putenv ("TZ=GST-1GDT");
foreach ($dates as $date) {
echo date("Y-m-d H:i:s\n", strtotime ($date));
}
?>
--EXPECT--
1999-10-13 00:00:00
1999-10-13 00:00:00
2000-01-19 00:00:00
2000-01-19 00:00:00
2001-12-21 00:00:00
2001-12-21 00:00:00
2001-12-21 12:16:00
2001-12-21 12:16:00
2001-10-22 21:19:58
2001-10-22 23:19:58
2001-10-22 23:32:58
2001-10-22 19:19:58
2001-10-22 19:06:58
1999-10-13 00:00:00
1999-10-13 00:00:00
2000-01-19 00:00:00
2000-01-19 00:00:00
2001-12-21 00:00:00
2001-12-21 00:00:00
2001-12-21 12:16:00
2001-12-21 12:16:00
2001-10-22 21:19:58
2001-10-23 01:19:58
2001-10-23 01:32:58
2001-10-22 21:19:58
2001-10-22 21:06:58
http://cvs.php.net/co.php/php-src/ext/date/tests/002.phpt?r=1.1&p=1
Index: php-src/ext/date/tests/002.phpt
+++ php-src/ext/date/tests/002.phpt
--TEST--
strtotime() function
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip Windows does not support dates prior to midnight (00:00:00),
January 1, 1970');
}
if ([EMAIL PROTECTED]("TZ=EST5") || getenv("TZ") != 'EST5') {
die("skip unable to change TZ enviroment variable\n");
}
?>
--FILE--
<?php
$dates = array (
"1999-10-13",
"Oct 13 1999",
"2000-01-19",
"Jan 19 2000",
"2001-12-21",
"Dec 21 2001",
"2001-12-21 12:16",
"Dec 21 2001 12:16",
"Dec 21 12:16",
"2001-10-22 21:19:58",
"2001-10-22 21:19:58-02",
"2001-10-22 21:19:58-0213",
"2001-10-22 21:19:58+02",
"2001-10-22 21:19:58+0213",
"2001-10-22T21:20:58-03:40",
"2001-10-22T211958-2",
"20011022T211958+0213",
"20011022T21:20+0215",
"1997W011",
"2004W101T05:00+0",
);
echo "*** GMT0\n";
putenv ("TZ=GMT0");
foreach ($dates as $date) {
echo date ("Y-m-d H:i:s\n", strtotime ($date));
}
echo "*** US/Eastern\n";
putenv("TZ=US/Eastern");
if( date("T") == "GMT" ) {
// POSIX style
putenv ("TZ=EST5EDT4,M4.1.0,M10.5.0");
}
foreach ($dates as $date) {
echo date ("Y-m-d H:i:s\n", strtotime ($date));
}
?>
--EXPECTF--
*** GMT0
1999-10-13 00:00:00
1999-10-13 00:00:00
2000-01-19 00:00:00
2000-01-19 00:00:00
2001-12-21 00:00:00
2001-12-21 00:00:00
2001-12-21 12:16:00
2001-12-21 12:16:00
%d-12-21 12:16:00
2001-10-22 21:19:58
2001-10-22 23:19:58
2001-10-22 23:32:58
2001-10-22 19:19:58
2001-10-22 19:06:58
2001-10-23 01:00:58
2001-10-22 23:19:58
2001-10-22 19:06:58
2001-10-22 19:05:00
1996-12-30 00:00:00
2004-03-01 05:00:00
*** US/Eastern
1999-10-13 00:00:00
1999-10-13 00:00:00
2000-01-19 00:00:00
2000-01-19 00:00:00
2001-12-21 00:00:00
2001-12-21 00:00:00
2001-12-21 12:16:00
2001-12-21 12:16:00
%d-12-21 12:16:00
2001-10-22 21:19:58
2001-10-22 19:19:58
2001-10-22 19:32:58
2001-10-22 15:19:58
2001-10-22 15:06:58
2001-10-22 21:00:58
2001-10-22 19:19:58
2001-10-22 15:06:58
2001-10-22 15:05:00
1996-12-30 00:00:00
2004-03-01 00:00:00
http://cvs.php.net/co.php/php-src/ext/date/tests/bug13142.phpt?r=1.1&p=1
Index: php-src/ext/date/tests/bug13142.phpt
+++ php-src/ext/date/tests/bug13142.phpt
--TEST--
Bug #13142 strtotime handling of "M d H:i:s Y" format
--SKIPIF--
<?php
if ([EMAIL PROTECTED]("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') {
die("skip unable to change TZ enviroment variable\n");
}
?>
--FILE--
<?php
putenv("TZ=US/Eastern");
if (date('T') == 'GMT') {
putenv("TZ=EST5EDT4,M4.1.0,M10.5.0");
}
echo date("r\n", strtotime("Sep 04 16:39:45 2001"));
echo date("r\n", strtotime("Sep 04 2001 16:39:45"));
?>
--EXPECT--
Tue, 04 Sep 2001 16:39:45 -0400
Tue, 04 Sep 2001 16:39:45 -0400
http://cvs.php.net/co.php/php-src/ext/date/tests/bug17988.phpt?r=1.1&p=1
Index: php-src/ext/date/tests/bug17988.phpt
+++ php-src/ext/date/tests/bug17988.phpt
--TEST--
Bug #17988 strtotime handling of postgresql timestamps
--FILE--
<?php
putenv("TZ=GMT");
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 GMT"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MET"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MEST"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 EDT"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-00"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+00"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-04"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+04"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-0300"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+0300"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-0330"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+0330"))."\n";
?>
--EXPECT--
2002-06-25 14:18:48
2002-06-25 14:18:48
2002-06-25 13:18:48
2002-06-25 12:18:48
2002-06-25 18:18:48
2002-06-25 14:18:48
2002-06-25 14:18:48
2002-06-25 18:18:48
2002-06-25 10:18:48
2002-06-25 17:18:48
2002-06-25 11:18:48
2002-06-25 17:48:48
2002-06-25 10:48:48
http://cvs.php.net/co.php/php-src/ext/date/tests/bug20382.phpt?r=1.1&p=1
Index: php-src/ext/date/tests/bug20382.phpt
+++ php-src/ext/date/tests/bug20382.phpt
--TEST--
Bug #20382 (strtotime ("Monday", $date) produces wrong result on DST changeover)
--FILE--
<?php
putenv("TZ=Europe/Amsterdam");
$tStamp = mktime (17, 17, 17, 10, 27, 2004);
echo "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_timestamp = strtotime ("Monday", $tStamp);
echo "result=". date("l Y-m-d H:i:s T", $strtotime_timestamp). "\n";
echo "wanted=Monday 2004-11-01 00:00:00 CET\n";
?>
--EXPECT--
tStamp=Wednesday 2004-10-27 17:17:17 CEST
result=Monday 2004-11-01 00:00:00 CET
wanted=Monday 2004-11-01 00:00:00 CET
http://cvs.php.net/co.php/php-src/ext/date/tests/bug26198.phpt?r=1.1&p=1
Index: php-src/ext/date/tests/bug26198.phpt
+++ php-src/ext/date/tests/bug26198.phpt
--TEST--
Bug #26198 (strtotime handling of "M Y" and "Y M" format)
--FILE--
<?php
echo date("F Y\n", strtotime("Oct 2001"));
echo date("M Y\n", strtotime("2001 Oct"));
?>
--EXPECT--
October 2001
Oct 2001
http://cvs.php.net/co.php/php-src/ext/date/tests/bug26317.phpt?r=1.1&p=1
Index: php-src/ext/date/tests/bug26317.phpt
+++ php-src/ext/date/tests/bug26317.phpt
--TEST--
Bug #26317 (military timezone offset signedness)
--SKIP--
if ([EMAIL PROTECTED]("TZ=GMT0") || getenv("TZ") != 'GMT0') {
die("skip unable to change TZ enviroment variable\n");
}
--FILE--
<?php
putenv("TZ=GMT0");
echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 16:20:42 Z"));
echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 09:20:42 T"));
echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 19:20:42 C"));
?>
--EXPECT--
2003-11-19 16:20:42
2003-11-19 16:20:42
2003-11-19 16:20:42
http://cvs.php.net/co.php/php-src/ext/date/tests/bug26320.phpt?r=1.1&p=1
Index: php-src/ext/date/tests/bug26320.phpt
+++ php-src/ext/date/tests/bug26320.phpt
--TEST--
Bug #26320 (strtotime handling of XML Schema/ISO 8601 format)
--SKIP--
if ([EMAIL PROTECTED]("TZ=GMT0") || getenv("TZ") != 'GMT0') {
die("skip unable to change TZ enviroment variable\n");
}
--FILE--
<?php
putenv("TZ=GMT0");
echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42"));
echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42Z"));
?>
--EXPECT--
2003-11-19 12:30:42
2003-11-19 12:30:42
http://cvs.php.net/co.php/php-src/ext/date/tests/bug27780.phpt?r=1.1&p=1
Index: php-src/ext/date/tests/bug27780.phpt
+++ php-src/ext/date/tests/bug27780.phpt
--TEST--
Bug #27780 (strtotime(+1 xxx) returns a wrong date/time)
--FILE--
<?php
$timezones = array (
"America/Chicago", "Europe/Amsterdam", "Asia/Jerusalem",
"Asia/Singapore", "America/Sao_Paulo"
);
$timestrings = array (
"2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59
seconds",
"2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60
seconds",
"2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61
seconds",
"2004-04-07 00:00:00 -21 days",
"2004-04-07 00:00:00 11 days ago",
"2004-04-07 00:00:00 -10 day +2 hours",
"2004-04-07 00:00:00 -1 day",
"2004-04-07 00:00:00",
"2004-04-07 00:00:00 +1 hour",
"2004-04-07 00:00:00 +2 hour",
"2004-04-07 00:00:00 +1 day",
"2004-04-07 00:00:00 1 day",
"2004-04-07 00:00:00 +21 days",
);
foreach ($timezones as $timezone) {
putenv("TZ=$timezone");
echo $timezone, "\n";
foreach ($timestrings as $timestring) {
$time = strtotime($timestring);
echo $time, strftime(" [%Y-%m-%d %H:%M:%S %Z]", $time), "
[$timestring]\n";
}
echo "\n";
}
?>
--EXPECT--
America/Chicago
1076824799 [2004-02-14 23:59:59 CST] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +59 seconds]
1076824800 [2004-02-15 00:00:00 CST] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +60 seconds]
1076824801 [2004-02-15 00:00:01 CST] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +61 seconds]
1079503200 [2004-03-17 00:00:00 CST] [2004-04-07 00:00:00 -21 days]
1080367200 [2004-03-27 00:00:00 CST] [2004-04-07 00:00:00 11 days ago]
1080460800 [2004-03-28 02:00:00 CST] [2004-04-07 00:00:00 -10 day +2 hours]
1081227600 [2004-04-06 00:00:00 CDT] [2004-04-07 00:00:00 -1 day]
1081314000 [2004-04-07 00:00:00 CDT] [2004-04-07 00:00:00]
1081317600 [2004-04-07 01:00:00 CDT] [2004-04-07 00:00:00 +1 hour]
1081321200 [2004-04-07 02:00:00 CDT] [2004-04-07 00:00:00 +2 hour]
1081400400 [2004-04-08 00:00:00 CDT] [2004-04-07 00:00:00 +1 day]
1081400400 [2004-04-08 00:00:00 CDT] [2004-04-07 00:00:00 1 day]
1083128400 [2004-04-28 00:00:00 CDT] [2004-04-07 00:00:00 +21 days]
Europe/Amsterdam
1076799599 [2004-02-14 23:59:59 CET] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +59 seconds]
1076799600 [2004-02-15 00:00:00 CET] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +60 seconds]
1076799601 [2004-02-15 00:00:01 CET] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +61 seconds]
1079478000 [2004-03-17 00:00:00 CET] [2004-04-07 00:00:00 -21 days]
1080342000 [2004-03-27 00:00:00 CET] [2004-04-07 00:00:00 11 days ago]
1080435600 [2004-03-28 03:00:00 CEST] [2004-04-07 00:00:00 -10 day +2 hours]
1081202400 [2004-04-06 00:00:00 CEST] [2004-04-07 00:00:00 -1 day]
1081288800 [2004-04-07 00:00:00 CEST] [2004-04-07 00:00:00]
1081292400 [2004-04-07 01:00:00 CEST] [2004-04-07 00:00:00 +1 hour]
1081296000 [2004-04-07 02:00:00 CEST] [2004-04-07 00:00:00 +2 hour]
1081375200 [2004-04-08 00:00:00 CEST] [2004-04-07 00:00:00 +1 day]
1081375200 [2004-04-08 00:00:00 CEST] [2004-04-07 00:00:00 1 day]
1083103200 [2004-04-28 00:00:00 CEST] [2004-04-07 00:00:00 +21 days]
Asia/Jerusalem
1076795999 [2004-02-14 23:59:59 IST] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +59 seconds]
1076796000 [2004-02-15 00:00:00 IST] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +60 seconds]
1076796001 [2004-02-15 00:00:01 IST] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +61 seconds]
1079474400 [2004-03-17 00:00:00 IST] [2004-04-07 00:00:00 -21 days]
1080338400 [2004-03-27 00:00:00 IST] [2004-04-07 00:00:00 11 days ago]
1080432000 [2004-03-28 02:00:00 IST] [2004-04-07 00:00:00 -10 day +2 hours]
1081202400 [2004-04-06 00:00:00 IST] [2004-04-07 00:00:00 -1 day]
1081288800 [2004-04-07 00:00:00 IST] [2004-04-07 00:00:00]
1081292400 [2004-04-07 02:00:00 IDT] [2004-04-07 00:00:00 +1 hour]
1081292400 [2004-04-07 02:00:00 IDT] [2004-04-07 00:00:00 +2 hour]
1081371600 [2004-04-08 00:00:00 IDT] [2004-04-07 00:00:00 +1 day]
1081371600 [2004-04-08 00:00:00 IDT] [2004-04-07 00:00:00 1 day]
1083099600 [2004-04-28 00:00:00 IDT] [2004-04-07 00:00:00 +21 days]
Asia/Singapore
1076774399 [2004-02-14 23:59:59 SGT] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +59 seconds]
1076774400 [2004-02-15 00:00:00 SGT] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +60 seconds]
1076774401 [2004-02-15 00:00:01 SGT] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +61 seconds]
1079452800 [2004-03-17 00:00:00 SGT] [2004-04-07 00:00:00 -21 days]
1080316800 [2004-03-27 00:00:00 SGT] [2004-04-07 00:00:00 11 days ago]
1080410400 [2004-03-28 02:00:00 SGT] [2004-04-07 00:00:00 -10 day +2 hours]
1081180800 [2004-04-06 00:00:00 SGT] [2004-04-07 00:00:00 -1 day]
1081267200 [2004-04-07 00:00:00 SGT] [2004-04-07 00:00:00]
1081270800 [2004-04-07 01:00:00 SGT] [2004-04-07 00:00:00 +1 hour]
1081274400 [2004-04-07 02:00:00 SGT] [2004-04-07 00:00:00 +2 hour]
1081353600 [2004-04-08 00:00:00 SGT] [2004-04-07 00:00:00 +1 day]
1081353600 [2004-04-08 00:00:00 SGT] [2004-04-07 00:00:00 1 day]
1083081600 [2004-04-28 00:00:00 SGT] [2004-04-07 00:00:00 +21 days]
America/Sao_Paulo
1076810399 [2004-02-14 23:59:59 BRST] [2004-04-07 00:00:00 -2 months +7 days
+23 hours +59 minutes +59 seconds]
1076810400 [2004-02-14 23:00:00 BRT] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +60 seconds]
1076810401 [2004-02-14 23:00:01 BRT] [2004-04-07 00:00:00 -2 months +7 days +23
hours +59 minutes +61 seconds]
1079492400 [2004-03-17 00:00:00 BRT] [2004-04-07 00:00:00 -21 days]
1080356400 [2004-03-27 00:00:00 BRT] [2004-04-07 00:00:00 11 days ago]
1080450000 [2004-03-28 02:00:00 BRT] [2004-04-07 00:00:00 -10 day +2 hours]
1081220400 [2004-04-06 00:00:00 BRT] [2004-04-07 00:00:00 -1 day]
1081306800 [2004-04-07 00:00:00 BRT] [2004-04-07 00:00:00]
1081310400 [2004-04-07 01:00:00 BRT] [2004-04-07 00:00:00 +1 hour]
1081314000 [2004-04-07 02:00:00 BRT] [2004-04-07 00:00:00 +2 hour]
1081393200 [2004-04-08 00:00:00 BRT] [2004-04-07 00:00:00 +1 day]
1081393200 [2004-04-08 00:00:00 BRT] [2004-04-07 00:00:00 1 day]
1083121200 [2004-04-28 00:00:00 BRT] [2004-04-07 00:00:00 +21 days]
http://cvs.php.net/co.php/php-src/ext/date/tests/bug28599.phpt?r=1.1&p=1
Index: php-src/ext/date/tests/bug28599.phpt
+++ php-src/ext/date/tests/bug28599.phpt
--TEST--
Bug #28599 (strtotime fails with zero base time)
--FILE--
<?php
print gmdate("d-m-Y H:i:s", strtotime("+30 minutes", 1100535573));
?>
--EXPECT--
15-11-2004 16:49:33
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php