smantoor                Fri Jan  9 05:10:33 2009 UTC

  Modified files:              
    /php-src/ext/date/tests     localtime_variation1.phpt 
                                localtime_variation2.phpt 
                                localtime_variation3.phpt 
                                localtime_variation4.phpt 
                                localtime_variation5.phpt 
                                localtime_basic.phpt 
  Log:
  New testcases for localtime function
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/localtime_variation1.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/date/tests/localtime_variation1.phpt
diff -u /dev/null php-src/ext/date/tests/localtime_variation1.phpt:1.2
--- /dev/null   Fri Jan  9 05:10:33 2009
+++ php-src/ext/date/tests/localtime_variation1.phpt    Fri Jan  9 05:10:33 2009
@@ -0,0 +1,658 @@
+--TEST--
+Test localtime() function : usage variation - Passing unexpected values to 
first argument 'timestamp'.
+--FILE--
+<?php
+/* Prototype  : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an 
associative array 
+ * if the associative_array argument is set to 1 other wise it is a regular 
array 
+ * Source code: ext/date/php_date.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$is_associative = true;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+       public function __toString() {
+               return "Class A object";
+       }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+      // float data
+      'float 10.5' => 10.5,
+      'float -10.5' => -10.5,
+      'float .5' => .5,
+
+      // array data
+      'empty array' => array(),
+      'int indexed array' => $index_array,
+      'associative array' => $assoc_array,
+      'nested arrays' => array('foo', $index_array, $assoc_array),
+
+      // null data
+      'uppercase NULL' => NULL,
+      'lowercase null' => null,
+
+      // boolean data
+      'lowercase true' => true,
+      'lowercase false' =>false,
+      'uppercase TRUE' =>TRUE,
+      'uppercase FALSE' =>FALSE,
+
+      // empty data
+      'empty string DQ' => "",
+      'empty string SQ' => '',
+
+      // string data
+      'string DQ' => "string",
+      'string SQ' => 'string',
+      'mixed case string' => "sTrInG",
+      'heredoc' => $heredoc,
+
+      // object data
+      'instance of classWithToString' => new classWithToString(),
+      'instance of classWithoutToString' => new classWithoutToString(),
+
+      // undefined data
+      'undefined var' => @$undefined_var,
+
+      // unset data
+      'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+      echo "\n--$key--\n";
+      var_dump( localtime($value) );
+      var_dump( localtime($value, $is_associative) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : usage variation ***
+
+--float 10.5--
+array(9) {
+  [0]=>
+  int(10)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--float -10.5--
+array(9) {
+  [0]=>
+  int(50)
+  [1]=>
+  int(59)
+  [2]=>
+  int(23)
+  [3]=>
+  int(31)
+  [4]=>
+  int(11)
+  [5]=>
+  int(69)
+  [6]=>
+  int(3)
+  [7]=>
+  int(364)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(50)
+  [u"tm_min"]=>
+  int(59)
+  [u"tm_hour"]=>
+  int(23)
+  [u"tm_mday"]=>
+  int(31)
+  [u"tm_mon"]=>
+  int(11)
+  [u"tm_year"]=>
+  int(69)
+  [u"tm_wday"]=>
+  int(3)
+  [u"tm_yday"]=>
+  int(364)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--float .5--
+array(9) {
+  [0]=>
+  int(0)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(0)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--empty array--
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line 
%d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line 
%d
+bool(false)
+
+--int indexed array--
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line 
%d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line 
%d
+bool(false)
+
+--associative array--
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line 
%d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line 
%d
+bool(false)
+
+--nested arrays--
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line 
%d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line 
%d
+bool(false)
+
+--uppercase NULL--
+array(9) {
+  [0]=>
+  int(0)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(0)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--lowercase null--
+array(9) {
+  [0]=>
+  int(0)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(0)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--lowercase true--
+array(9) {
+  [0]=>
+  int(1)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(1)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--lowercase false--
+array(9) {
+  [0]=>
+  int(0)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(0)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--uppercase TRUE--
+array(9) {
+  [0]=>
+  int(1)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(1)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--uppercase FALSE--
+array(9) {
+  [0]=>
+  int(0)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(0)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--empty string DQ--
+
+Warning: localtime() expects parameter 1 to be long, Unicode string given in 
%s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, Unicode string given in 
%s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: localtime() expects parameter 1 to be long, Unicode string given in 
%s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, Unicode string given in 
%s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: localtime() expects parameter 1 to be long, Unicode string given in 
%s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, Unicode string given in 
%s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: localtime() expects parameter 1 to be long, Unicode string given in 
%s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, Unicode string given in 
%s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: localtime() expects parameter 1 to be long, Unicode string given in 
%s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, Unicode string given in 
%s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: localtime() expects parameter 1 to be long, Unicode string given in 
%s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, Unicode string given in 
%s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: localtime() expects parameter 1 to be long, object given in %s on 
line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, object given in %s on 
line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: localtime() expects parameter 1 to be long, object given in %s on 
line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, object given in %s on 
line %d
+bool(false)
+
+--undefined var--
+array(9) {
+  [0]=>
+  int(0)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(0)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--unset var--
+array(9) {
+  [0]=>
+  int(0)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(0)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/localtime_variation2.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/date/tests/localtime_variation2.phpt
diff -u /dev/null php-src/ext/date/tests/localtime_variation2.phpt:1.2
--- /dev/null   Fri Jan  9 05:10:33 2009
+++ php-src/ext/date/tests/localtime_variation2.phpt    Fri Jan  9 05:10:33 2009
@@ -0,0 +1,643 @@
+--TEST--
+Test localtime() function : usage variation - Passing unexpected values to 
second argument 'associative_array'.
+--FILE--
+<?php
+/* Prototype  : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an 
associative array 
+ * if the associative_array argument is set to 1 other wise it is a regular 
array 
+ * Source code: ext/date/php_date.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$timestamp = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+       public function __toString() {
+               return "Class A object";
+       }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+      // int data
+      'int 0' => 0,
+      'int 1' => 1,
+      'int 12345' => 12345,
+      'int -12345' => -2345,
+
+      // float data
+      'float 10.5' => 10.5,
+      'float -10.5' => -10.5,
+      'float 12.3456789000e10' => 12.3456789000e10,
+      'float -12.3456789000e10' => -12.3456789000e10,
+      'float .5' => .5,
+
+      // array data
+      'empty array' => array(),
+      'int indexed array' => $index_array,
+      'associative array' => $assoc_array,
+      'nested arrays' => array('foo', $index_array, $assoc_array),
+
+      // null data
+      'uppercase NULL' => NULL,
+      'lowercase null' => null,
+
+      // boolean data
+      'lowercase true' => true,
+      'lowercase false' =>false,
+      'uppercase TRUE' =>TRUE,
+      'uppercase FALSE' =>FALSE,
+
+      // empty data
+      'empty string DQ' => "",
+      'empty string SQ' => '',
+
+      // string data
+      'string DQ' => "string",
+      'string SQ' => 'string',
+      'mixed case string' => "sTrInG",
+      'heredoc' => $heredoc,
+
+      // object data
+      'instance of classWithToString' => new classWithToString(),
+      'instance of classWithoutToString' => new classWithoutToString(),
+
+      // undefined data
+      'undefined var' => @$undefined_var,
+
+      // unset data
+      'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for associative_array
+
+foreach($inputs as $key =>$value) {
+      echo "\n--$key--\n";
+      var_dump( localtime($timestamp, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : usage variation ***
+
+--int 0--
+array(9) {
+  [0]=>
+  int(10)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+
+--int 1--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--int 12345--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--int -12345--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--float 10.5--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--float -10.5--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--float 12.3456789000e10--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--float -12.3456789000e10--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--float .5--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--empty array--
+
+Warning: localtime() expects parameter 2 to be boolean, array given in %s on 
line %d
+bool(false)
+
+--int indexed array--
+
+Warning: localtime() expects parameter 2 to be boolean, array given in %s on 
line %d
+bool(false)
+
+--associative array--
+
+Warning: localtime() expects parameter 2 to be boolean, array given in %s on 
line %d
+bool(false)
+
+--nested arrays--
+
+Warning: localtime() expects parameter 2 to be boolean, array given in %s on 
line %d
+bool(false)
+
+--uppercase NULL--
+array(9) {
+  [0]=>
+  int(10)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+
+--lowercase null--
+array(9) {
+  [0]=>
+  int(10)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+
+--lowercase true--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--lowercase false--
+array(9) {
+  [0]=>
+  int(10)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+
+--uppercase TRUE--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--uppercase FALSE--
+array(9) {
+  [0]=>
+  int(10)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+
+--empty string DQ--
+array(9) {
+  [0]=>
+  int(10)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+
+--empty string SQ--
+array(9) {
+  [0]=>
+  int(10)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+
+--string DQ--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--string SQ--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--mixed case string--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--heredoc--
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--instance of classWithToString--
+
+Warning: localtime() expects parameter 2 to be boolean, object given in %s on 
line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: localtime() expects parameter 2 to be boolean, object given in %s on 
line %d
+bool(false)
+
+--undefined var--
+array(9) {
+  [0]=>
+  int(10)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+
+--unset var--
+array(9) {
+  [0]=>
+  int(10)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/localtime_variation3.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/date/tests/localtime_variation3.phpt
diff -u /dev/null php-src/ext/date/tests/localtime_variation3.phpt:1.2
--- /dev/null   Fri Jan  9 05:10:33 2009
+++ php-src/ext/date/tests/localtime_variation3.phpt    Fri Jan  9 05:10:33 2009
@@ -0,0 +1,116 @@
+--TEST--
+Test localtime() function : usage variation - Passing higher positive and 
negetive float values to timestamp.
+--FILE--
+<?php
+/* Prototype  : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an 
associative array 
+ * if the associative_array argument is set to 1 other wise it is a regular 
array 
+ * Source code: ext/date/php_date.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$is_associative = true;
+
+echo "\n-- Testing localtime() function with 'float 12.3456789000e10' to 
timestamp --\n";
+$timestamp = 12.3456789000e10;
+var_dump( localtime($timestamp) );
+var_dump( localtime($timestamp, $is_associative) );
+
+echo "\n-- Testing localtime() function with 'float -12.3456789000e10' to 
timestamp --\n";
+$timestamp = -12.3456789000e10;
+var_dump( localtime($timestamp) );
+var_dump( localtime($timestamp, $is_associative) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing localtime\(\) : usage variation \*\*\*
+
+-- Testing localtime\(\) function with 'float 12.3456789000e10' to timestamp --
+array\(9\) {
+  \[0\]=>
+  int\((7|0)\)
+  \[1\]=>
+  int\((14|30)\)
+  \[2\]=>
+  int\((3|0)\)
+  \[3\]=>
+  int\((19|11)\)
+  \[4\]=>
+  int\((0|2)\)
+  \[5\]=>
+  int\((138|3982)\)
+  \[6\]=>
+  int\((2|6)\)
+  \[7\]=>
+  int\((18|69)\)
+  \[8\]=>
+  int\(0\)
+}
+array\(9\) {
+  \[u"tm_sec"\]=>
+  int\((7|0)\)
+  \[u"tm_min"\]=>
+  int\((14|30)\)
+  \[u"tm_hour"\]=>
+  int\((3|0)\)
+  \[u"tm_mday"\]=>
+  int\((19|11)\)
+  \[u"tm_mon"\]=>
+  int\((0|2)\)
+  \[u"tm_year"\]=>
+  int\((138|3982)\)
+  \[u"tm_wday"\]=>
+  int\((2|6)\)
+  \[u"tm_yday"\]=>
+  int\((18|69)\)
+  \[u"tm_isdst"\]=>
+  int\(0\)
+}
+
+-- Testing localtime\(\) function with 'float -12.3456789000e10' to timestamp 
--
+array\(9\) {
+  \[0\]=>
+  int\((52|0)\)
+  \[1\]=>
+  int\((45|30)\)
+  \[2\]=>
+  int\((20|23)\)
+  \[3\]=>
+  int\((13|22)\)
+  \[4\]=>
+  int\((11|9)\)
+  \[5\]=>
+  int\((1|-3843)\)
+  \[6\]=>
+  int\((5|-5)\)
+  \[7\]=>
+  int\((346|294)\)
+  \[8\]=>
+  int\(0\)
+}
+array\(9\) {
+  \[u"tm_sec"\]=>
+  int\((52|0)\)
+  \[u"tm_min"\]=>
+  int\((45|30)\)
+  \[u"tm_hour"\]=>
+  int\((20|23)\)
+  \[u"tm_mday"\]=>
+  int\((13|22)\)
+  \[u"tm_mon"\]=>
+  int\((11|9)\)
+  \[u"tm_year"\]=>
+  int\((1|-3843)\)
+  \[u"tm_wday"\]=>
+  int\((5|-5)\)
+  \[u"tm_yday"\]=>
+  int\((346|294)\)
+  \[u"tm_isdst"\]=>
+  int\(0\)
+}
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/localtime_variation4.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/date/tests/localtime_variation4.phpt
diff -u /dev/null php-src/ext/date/tests/localtime_variation4.phpt:1.2
--- /dev/null   Fri Jan  9 05:10:33 2009
+++ php-src/ext/date/tests/localtime_variation4.phpt    Fri Jan  9 05:10:33 2009
@@ -0,0 +1,162 @@
+--TEST--
+Test localtime() function : usage variation - Passing octal values to 
timestamp.
+--FILE--
+<?php
+/* Prototype  : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an 
associative array 
+ * if the associative_array argument is set to 1 other wise it is a regular 
array 
+ * Source code: ext/date/php_date.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$is_associative = true;
+
+//array of values to iterate over
+$inputs = array(
+
+      'Octal 0' => 00,
+         'Octal 10' => 012,
+         'Octal -10' => -012
+);     
+
+foreach($inputs as $key =>$value) {
+      echo "\n--$key--\n";
+         var_dump( localtime($value) );
+         var_dump( localtime($value, $is_associative) );
+}
+         
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : usage variation ***
+
+--Octal 0--
+array(9) {
+  [0]=>
+  int(0)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(0)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--Octal 10--
+array(9) {
+  [0]=>
+  int(10)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--Octal -10--
+array(9) {
+  [0]=>
+  int(50)
+  [1]=>
+  int(59)
+  [2]=>
+  int(23)
+  [3]=>
+  int(31)
+  [4]=>
+  int(11)
+  [5]=>
+  int(69)
+  [6]=>
+  int(3)
+  [7]=>
+  int(364)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(50)
+  [u"tm_min"]=>
+  int(59)
+  [u"tm_hour"]=>
+  int(23)
+  [u"tm_mday"]=>
+  int(31)
+  [u"tm_mon"]=>
+  int(11)
+  [u"tm_year"]=>
+  int(69)
+  [u"tm_wday"]=>
+  int(3)
+  [u"tm_yday"]=>
+  int(364)
+  [u"tm_isdst"]=>
+  int(0)
+}
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/localtime_variation5.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/date/tests/localtime_variation5.phpt
diff -u /dev/null php-src/ext/date/tests/localtime_variation5.phpt:1.2
--- /dev/null   Fri Jan  9 05:10:33 2009
+++ php-src/ext/date/tests/localtime_variation5.phpt    Fri Jan  9 05:10:33 2009
@@ -0,0 +1,162 @@
+--TEST--
+Test localtime() function : usage variation - Passing hexa decimal values to 
timestamp.
+--FILE--
+<?php
+/* Prototype  : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an 
associative array 
+ * if the associative_array argument is set to 1 other wise it is a regular 
array 
+ * Source code: ext/date/php_date.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$is_associative = true;
+
+//array of values to iterate over
+$inputs = array(
+
+      'Hexa-decimal 0' => 0x0,
+         'Hexa-decimal 10' => 0xA,
+         'Hexa-decimal -10' => -0XA
+);     
+
+foreach($inputs as $key =>$value) {
+      echo "\n--$key--\n";
+         var_dump( localtime($value) );
+         var_dump( localtime($value, $is_associative) );
+}
+         
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : usage variation ***
+
+--Hexa-decimal 0--
+array(9) {
+  [0]=>
+  int(0)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(0)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--Hexa-decimal 10--
+array(9) {
+  [0]=>
+  int(10)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+
+--Hexa-decimal -10--
+array(9) {
+  [0]=>
+  int(50)
+  [1]=>
+  int(59)
+  [2]=>
+  int(23)
+  [3]=>
+  int(31)
+  [4]=>
+  int(11)
+  [5]=>
+  int(69)
+  [6]=>
+  int(3)
+  [7]=>
+  int(364)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [u"tm_sec"]=>
+  int(50)
+  [u"tm_min"]=>
+  int(59)
+  [u"tm_hour"]=>
+  int(23)
+  [u"tm_mday"]=>
+  int(31)
+  [u"tm_mon"]=>
+  int(11)
+  [u"tm_year"]=>
+  int(69)
+  [u"tm_wday"]=>
+  int(3)
+  [u"tm_yday"]=>
+  int(364)
+  [u"tm_isdst"]=>
+  int(0)
+}
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/localtime_basic.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/date/tests/localtime_basic.phpt
diff -u /dev/null php-src/ext/date/tests/localtime_basic.phpt:1.2
--- /dev/null   Fri Jan  9 05:10:33 2009
+++ php-src/ext/date/tests/localtime_basic.phpt Fri Jan  9 05:10:33 2009
@@ -0,0 +1,93 @@
+--TEST--
+Test localtime() function : basic functionality 
+--FILE--
+<?php
+/* Prototype  : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an 
associative 
+ * array if the associative_array argument is set to 1 other wise it is a 
regular array 
+ * Source code: ext/date/php_date.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing localtime() : basic functionality ***\n";
+
+date_default_timezone_set("UTC");
+
+// Initialise all required variables
+$timestamp = 10;
+$associative_array = true;
+
+// Calling localtime() with all possible arguments
+var_dump( localtime($timestamp, $associative_array) );
+
+// Calling localtime() with possible optional arguments
+var_dump( localtime($timestamp) );
+
+// Calling localtime() with mandatory arguments
+var_dump( localtime() );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : basic functionality ***
+array(9) {
+  [u"tm_sec"]=>
+  int(10)
+  [u"tm_min"]=>
+  int(0)
+  [u"tm_hour"]=>
+  int(0)
+  [u"tm_mday"]=>
+  int(1)
+  [u"tm_mon"]=>
+  int(0)
+  [u"tm_year"]=>
+  int(70)
+  [u"tm_wday"]=>
+  int(4)
+  [u"tm_yday"]=>
+  int(0)
+  [u"tm_isdst"]=>
+  int(0)
+}
+array(9) {
+  [0]=>
+  int(10)
+  [1]=>
+  int(0)
+  [2]=>
+  int(0)
+  [3]=>
+  int(1)
+  [4]=>
+  int(0)
+  [5]=>
+  int(70)
+  [6]=>
+  int(4)
+  [7]=>
+  int(0)
+  [8]=>
+  int(0)
+}
+array(9) {
+  [0]=>
+  int(%d)
+  [1]=>
+  int(%d)
+  [2]=>
+  int(%d)
+  [3]=>
+  int(%d)
+  [4]=>
+  int(%d)
+  [5]=>
+  int(%d)
+  [6]=>
+  int(%d)
+  [7]=>
+  int(%d)
+  [8]=>
+  int(%d)
+}
+===DONE===

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

Reply via email to