cvs: pear /Date/tests/bugs bug-11313.phpt bug-13545.phpt bug-2378-1.phpt bug-2378.phpt

[email protected] ("Charles Woodcock") Thu, 08 May 2008 22:45:38 -0000
Newsgroups php.pear.cvs
Message-ID <cvsc012341210286738@cvsserver>
c01234		Thu May  8 22:45:38 2008 UTC

  Added files:                 
    /pear/Date/tests/bugs	bug-11313.phpt bug-13545.phpt bug-2378-1.phpt 

  Modified files:              
    /pear/Date/tests/bugs	bug-2378.phpt 
  Log:
  Updating bug files
  
http://cvs.php.net/viewvc.cgi/pear/Date/tests/bugs/bug-2378.phpt?r1=1.4&r2=1.5&diff_format=u
Index: pear/Date/tests/bugs/bug-2378.phpt
diff -u pear/Date/tests/bugs/bug-2378.phpt:1.4 pear/Date/tests/bugs/bug-2378.phpt:1.5
--- pear/Date/tests/bugs/bug-2378.phpt:1.4	Wed Nov 28 23:49:37 2007
+++ pear/Date/tests/bugs/bug-2378.phpt	Thu May  8 22:45:37 2008
@@ -30,19 +30,19 @@
 
     if (PEAR::isError($res = $date->convertTZbyID('UTC'))) { print_r($res); exit(); }
     $ts = $date->getTime();
-    echo 'Greenwich       = ' . str_pad($ts, 10) . ' - ' . $date->format2('YYYY-MM-DD HH:MI:SSSTZH:TZM') . "\n";
+    echo 'Greenwich       = ' . str_pad($ts, 10) . ' - ' . $date->formatLikeSQL('YYYY-MM-DD HH:MI:SSSTZH:TZM') . "\n";
 
     if (PEAR::isError($res = $date->convertTZbyID('Europe/London'))) { print_r($res); exit(); }
     $ts = $date->getTime();
-    echo 'London  ' . $date->format2('("UTC"NPSTZH)') . " = " . str_pad($ts, 10) . ' - ' . $date->format2('YYYY-MM-DD HH:MI:SSSTZH:TZM') . "\n";
+    echo 'London  ' . $date->formatLikeSQL('("UTC"NPSTZH)') . " = " . str_pad($ts, 10) . ' - ' . $date->formatLikeSQL('YYYY-MM-DD HH:MI:SSSTZH:TZM') . "\n";
 
     if (PEAR::isError($res = $date->convertTZbyID('Europe/Paris'))) { print_r($res); exit(); }
     $ts = $date->getTime();
-    echo 'Paris   ' . $date->format2('("UTC"NPSTZH)') . " = " . str_pad($ts, 10) . ' - ' . $date->format2('YYYY-MM-DD HH:MI:SSSTZH:TZM') . "\n";
+    echo 'Paris   ' . $date->formatLikeSQL('("UTC"NPSTZH)') . " = " . str_pad($ts, 10) . ' - ' . $date->formatLikeSQL('YYYY-MM-DD HH:MI:SSSTZH:TZM') . "\n";
 
     if (PEAR::isError($res = $date->convertTZbyID('Asia/Jakarta'))) { print_r($res); exit(); }
     $ts = $date->getTime();
-    echo 'Jakarta ' . $date->format2('("UTC"NPSTZH)') . " = " . str_pad($ts, 10) . ' - ' . $date->format2('YYYY-MM-DD HH:MI:SSSTZH:TZM') . "\n";
+    echo 'Jakarta ' . $date->formatLikeSQL('("UTC"NPSTZH)') . " = " . str_pad($ts, 10) . ' - ' . $date->formatLikeSQL('YYYY-MM-DD HH:MI:SSSTZH:TZM') . "\n";
 }
 ?>
 --EXPECT--

http://cvs.php.net/viewvc.cgi/pear/Date/tests/bugs/bug-11313.phpt?view=markup&rev=1.1
Index: pear/Date/tests/bugs/bug-11313.phpt
+++ pear/Date/tests/bugs/bug-11313.phpt
--TEST--
Bug #11313 DST time change not handled correctly
--FILE--
<?php

putenv('TZ=Europe/Moscow');
//include_once('debug.php');
require_once 'Date.php';

$date = new Date('2007-03-25 03:00:04');
$tmp = new Date($date);

$PRINT_FORMAT = "%Y-%m-%d %H:%M:%S %Z%O";

//var_dump($date->tz, 'TimeZone');
printf("% 50s: %s\n", "Actual date", $date->format($PRINT_FORMAT));

$tmp->copy($date);
$tmp->subtractSpan(new Date_Span('0:00:00:05'));
printf("% 50s: %s\n", 'Subtracting 5 seconds',
$tmp->format($PRINT_FORMAT));

$tmp->copy($date);
$tmp->subtractSpan(new Date_Span('0:00:20:00'));
printf("% 50s: %s\n", "Subtracting 20 minutes",
$tmp->format($PRINT_FORMAT));

$tmp->copy($date);
$tmp->subtractSpan(new Date_Span('0:02:30:00'));
printf("% 50s: %s\n", "Subtracting 2 hours 30 minutes",
$tmp->format($PRINT_FORMAT));

$tmp->copy($date);
$tmp->subtractSpan(new Date_Span('0:10:00:00'));
printf("% 50s: %s\n", "Subtracting 10 hours",
$tmp->format($PRINT_FORMAT));

$tmp->copy($date);
$tmp->subtractSpan(new Date_Span('3:00:00:00'));
printf("% 50s: %s\n", "Subtracting 3 days",
$tmp->format($PRINT_FORMAT));

?>
--EXPECT--
                                       Actual date: 2007-03-25 03:00:04 MSD+04:00
                             Subtracting 5 seconds: 2007-03-25 01:59:59 MSD+03:00
                            Subtracting 20 minutes: 2007-03-25 01:40:04 MSD+03:00
                    Subtracting 2 hours 30 minutes: 2007-03-24 23:30:04 MSK+03:00
                              Subtracting 10 hours: 2007-03-24 16:00:04 MSK+03:00
                                Subtracting 3 days: 2007-03-22 02:00:04 MSK+03:00


http://cvs.php.net/viewvc.cgi/pear/Date/tests/bugs/bug-13545.phpt?view=markup&rev=1.1
Index: pear/Date/tests/bugs/bug-13545.phpt
+++ pear/Date/tests/bugs/bug-13545.phpt
--TEST--
Bug #13545 Date_Span::set() doesn't work when passed an int and format
--FILE--
<?php

require_once 'Date.php';

$span = new Date_Span(1, '%D');
echo $span->format('%D-%S');

?> 
--EXPECT--
1-00

http://cvs.php.net/viewvc.cgi/pear/Date/tests/bugs/bug-2378-1.phpt?view=markup&rev=1.1
Index: pear/Date/tests/bugs/bug-2378-1.phpt
+++ pear/Date/tests/bugs/bug-2378-1.phpt
--TEST--
Bug #2378: Date::getDate(DATE_FORMAT_UNIXTIME) doesn't convert to GMT
--FILE--
<?php

require_once "Date.php";


$date =& new Date(1095935549);
echo $date->getTime()."\n";
$date->convertTZbyID('America/Los_Angeles');
echo $date->getTime()."\n";

?>
--EXPECT--
1095935549
1095935549