home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / bug674.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  1.2 KB  |  51 lines

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