1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
<?php
require_once 'Date.php';
$error = false;
$dates = array (
array( array(2003,3,17),'20030323','20030317','20030324','20030310'),
array( array(2003,3,20),'20030323','20030317','20030324','20030310'),
array( array(2003,3,23),'20030323','20030317','20030324','20030310')
);
foreach ($dates as $d) {
$date = $d[0];
$res = Date_Calc::endOfWeek($date[2],$date[1],$date[0]);
if ($res!=$d[1]) {
echo "Bug 674 eow: " . $date[0].$date[1].$date[2]." failed\n";
$error = true;
}
}
foreach ($dates as $d) {
$date = $d[0];
$res = Date_Calc::beginOfWeek($date[2],$date[1],$date[0]);
if ($res!=$d[2]) {
echo "Bug 674 bow: " . $date[0].$date[1].$date[2]." failed\n";
$error = true;
}
}
foreach ($dates as $d) {
$date = $d[0];
$res = Date_Calc::beginOfNextWeek($date[2],$date[1],$date[0]);
if ($res!=$d[3]) {
echo "Bug 674 bonw: " . $date[0].$date[1].$date[2]." failed\n";
$error = true;
}
}
foreach ($dates as $d) {
$date = $d[0];
$res = Date_Calc::beginOfPrevWeek($date[2],$date[1],$date[0]);
if ($res!=$d[4]) {
echo "Bug 674 bopw: " . $date[0].$date[1].$date[2]." failed\n";
$error = true;
}
}
if (!$error) {
echo "Bug 674: OK\n";
}
?>
|