derick                                   Sat, 13 Nov 2010 16:30:22 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=305319

Log:
- Copied test cases (that all fail?!) from 5.3 to trunk.

Changed paths:
    A   php/php-src/trunk/ext/date/tests/bug48187.phpt
    A   php/php-src/trunk/ext/date/tests/bug50475.phpt
    A   php/php-src/trunk/ext/date/tests/bug51819.phpt
    A   php/php-src/trunk/ext/date/tests/bug51994.phpt

Added: php/php-src/trunk/ext/date/tests/bug48187.phpt
===================================================================
--- php/php-src/trunk/ext/date/tests/bug48187.phpt                              
(rev 0)
+++ php/php-src/trunk/ext/date/tests/bug48187.phpt      2010-11-13 16:30:22 UTC 
(rev 305319)
@@ -0,0 +1,26 @@
+--TEST--
+Bug #48187 (DateTime::diff() corrupting microtime() result)
+--FILE--
+<?php
+// two arbitrary dates
+$date1 = new DateTime('2005-07-23');
+$date2 = new DateTime('2006-02-14');
+
+$begin_u = microtime(true);
+$begin_t = time();
+
+if (microtime(true) - $begin_u < 1) {
+    var_dump('microtime() difference less 1 second');
+} else {
+    var_dump('microtime() difference greater or equal 1 second');
+}
+
+if (time() - $begin_t < 1) {
+    var_dump('time() difference less 1 second');
+} else {
+    var_dump('time() difference greater or equal 1 second');
+}
+?>
+--EXPECTF--
+string(36) "microtime() difference less 1 second"
+string(31) "time() difference less 1 second"
\ No newline at end of file

Added: php/php-src/trunk/ext/date/tests/bug50475.phpt
===================================================================
--- php/php-src/trunk/ext/date/tests/bug50475.phpt                              
(rev 0)
+++ php/php-src/trunk/ext/date/tests/bug50475.phpt      2010-11-13 16:30:22 UTC 
(rev 305319)
@@ -0,0 +1,18 @@
+--TEST--
+Bug #50475 (DateTime::setISODate followed by DateTime::setTime)
+--FILE--
+<?php
+date_default_timezone_set('Asia/Calcutta');
+
+$date = new DateTime('18-01-2009 00:00:00');
+
+$date->setISODate(2009, 6, 1);
+
+var_dump($date->format('Y-m-d H:i:s'));
+
+$date->setTime(8, 0);
+var_dump($date->format('Y-m-d H:i:s'));
+?>
+--EXPECT--
+string(19) "2009-02-02 00:00:00"
+string(19) "2009-02-02 08:00:00"
\ No newline at end of file

Added: php/php-src/trunk/ext/date/tests/bug51819.phpt
===================================================================
--- php/php-src/trunk/ext/date/tests/bug51819.phpt                              
(rev 0)
+++ php/php-src/trunk/ext/date/tests/bug51819.phpt      2010-11-13 16:30:22 UTC 
(rev 305319)
@@ -0,0 +1,31 @@
+--TEST--
+Bug #51819 (Case discrepancy in timezone names cause Uncaught exception and 
fatal error)
+--FILE--
+<?php
+$aTzAbbr = timezone_abbreviations_list();
+
+$aTz = array();
+foreach (array_keys($aTzAbbr) as $sKey) {
+    foreach (array_keys($aTzAbbr[$sKey]) as $iIndex) {
+        $sTz = $aTzAbbr[$sKey][$iIndex]['timezone_id'];
+
+        if (! in_array($sTz, $aTz)) {
+            array_push($aTz, $sTz);
+        }
+    }
+}
+
+foreach ($aTz as $sTz) {
+    $sDate = '2010-05-15 00:00:00 ' . $sTz;
+
+    try {
+        $oDateTime = new DateTime($sDate);
+    } catch (Exception $oException) {
+        var_dump($oException->getMessage());
+    }
+}
+
+var_dump('this should be the only output');
+?>
+--EXPECTF--
+string(30) "this should be the only output"
\ No newline at end of file

Added: php/php-src/trunk/ext/date/tests/bug51994.phpt
===================================================================
--- php/php-src/trunk/ext/date/tests/bug51994.phpt                              
(rev 0)
+++ php/php-src/trunk/ext/date/tests/bug51994.phpt      2010-11-13 16:30:22 UTC 
(rev 305319)
@@ -0,0 +1,38 @@
+--TEST--
+Bug #51994 (date_parse_from_format is parsing invalid date using 'yz' format)
+--FILE--
+<?php
+$trans_date = '10153'; // 152nd day of year 2010 -> 03.06.2010
+$a_date        = date_parse_from_format('yz', $trans_date);
+
+var_dump($a_date);
+?>
+--EXPECTF--
+array(12) {
+  ["year"]=>
+  int(2010)
+  ["month"]=>
+  int(6)
+  ["day"]=>
+  int(3)
+  ["hour"]=>
+  bool(false)
+  ["minute"]=>
+  bool(false)
+  ["second"]=>
+  bool(false)
+  ["fraction"]=>
+  bool(false)
+  ["warning_count"]=>
+  int(0)
+  ["warnings"]=>
+  array(0) {
+  }
+  ["error_count"]=>
+  int(0)
+  ["errors"]=>
+  array(0) {
+  }
+  ["is_localtime"]=>
+  bool(false)
+}
\ No newline at end of file

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to