more date() tests

This commit is contained in:
Antony Dovgal 2006-06-27 15:08:16 +00:00
parent ac4f8071c5
commit 5f024dcc16
2 changed files with 120 additions and 0 deletions

47
ext/date/tests/003.phpt Normal file
View File

@ -0,0 +1,47 @@
--TEST--
date suffixes test
--INI--
date.timezone=UTC
--FILE--
<?php
for ($i = 0; $i < 32; $i++) {
var_dump(date("jS", mktime(0,0,0, 1, $i, 2006)));
}
echo "Done\n";
?>
--EXPECTF--
string(4) "31st"
string(3) "1st"
string(3) "2nd"
string(3) "3rd"
string(3) "4th"
string(3) "5th"
string(3) "6th"
string(3) "7th"
string(3) "8th"
string(3) "9th"
string(4) "10th"
string(4) "11th"
string(4) "12th"
string(4) "13th"
string(4) "14th"
string(4) "15th"
string(4) "16th"
string(4) "17th"
string(4) "18th"
string(4) "19th"
string(4) "20th"
string(4) "21st"
string(4) "22nd"
string(4) "23rd"
string(4) "24th"
string(4) "25th"
string(4) "26th"
string(4) "27th"
string(4) "28th"
string(4) "29th"
string(4) "30th"
string(4) "31st"
Done

73
ext/date/tests/004.phpt Normal file
View File

@ -0,0 +1,73 @@
--TEST--
date() format params
--FILE--
<?php
date_default_timezone_set("UTC");
$tz = array("UTC", "Asia/Jerusalem", "America/Chicago", "Europe/London");
$t = mktime(0, 0, 0, 6, 27, 2006);
foreach ($tz as $zone) {
date_default_timezone_set($zone);
var_dump(date("w", $t));
var_dump(date("z", $t));
var_dump(date("n", $t));
var_dump(date("t", $t));
var_dump(date("L", $t));
var_dump(date("a", $t));
var_dump(date("B", $t));
var_dump(date("g", $t));
var_dump(date("G", $t));
var_dump(date("Z", $t));
var_dump(date("U", $t));
}
echo "Done\n";
?>
--EXPECTF--
string(1) "2"
string(3) "177"
string(1) "6"
string(2) "30"
string(1) "0"
string(2) "am"
string(3) "041"
string(2) "12"
string(1) "0"
string(1) "0"
string(10) "1151366400"
string(1) "2"
string(3) "177"
string(1) "6"
string(2) "30"
string(1) "0"
string(2) "am"
string(3) "041"
string(1) "3"
string(1) "3"
string(5) "10800"
string(10) "1151366400"
string(1) "1"
string(3) "176"
string(1) "6"
string(2) "30"
string(1) "0"
string(2) "pm"
string(3) "041"
string(1) "7"
string(2) "19"
string(6) "-18000"
string(10) "1151366400"
string(1) "2"
string(3) "177"
string(1) "6"
string(2) "30"
string(1) "0"
string(2) "am"
string(3) "041"
string(1) "1"
string(1) "1"
string(4) "3600"
string(10) "1151366400"
Done