summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjay Mantoor <smantoor@php.net>2008-12-15 10:36:53 +0000
committerSanjay Mantoor <smantoor@php.net>2008-12-15 10:36:53 +0000
commitd0eaa59d0f730d244b044a4b42052722412fc18e (patch)
treea39eac34c3c385ea5d4851c7a1bb56432c2212e8
parent29c885c8bdd7547fba472c60b6a25ead2dc8e588 (diff)
downloadphp-git-d0eaa59d0f730d244b044a4b42052722412fc18e.tar.gz
New testcases for gmdate function
-rw-r--r--ext/date/tests/gmdate_basic.phpt30
-rw-r--r--ext/date/tests/gmdate_error.phpt41
-rw-r--r--ext/date/tests/gmdate_variation1.phpt221
-rw-r--r--ext/date/tests/gmdate_variation10.phpt69
-rw-r--r--ext/date/tests/gmdate_variation11.phpt45
-rw-r--r--ext/date/tests/gmdate_variation12.phpt48
-rw-r--r--ext/date/tests/gmdate_variation13.phpt82
-rw-r--r--ext/date/tests/gmdate_variation14.phpt34
-rw-r--r--ext/date/tests/gmdate_variation2.phpt210
-rw-r--r--ext/date/tests/gmdate_variation3.phpt59
-rw-r--r--ext/date/tests/gmdate_variation4.phpt45
-rw-r--r--ext/date/tests/gmdate_variation5.phpt29
-rw-r--r--ext/date/tests/gmdate_variation6.phpt61
-rw-r--r--ext/date/tests/gmdate_variation7.phpt60
-rw-r--r--ext/date/tests/gmdate_variation8.phpt60
-rw-r--r--ext/date/tests/gmdate_variation9.phpt81
16 files changed, 1175 insertions, 0 deletions
diff --git a/ext/date/tests/gmdate_basic.phpt b/ext/date/tests/gmdate_basic.phpt
new file mode 100644
index 0000000000..ae036cacba
--- /dev/null
+++ b/ext/date/tests/gmdate_basic.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test gmdate() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : basic functionality ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$format = DATE_ISO8601;
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+// Calling gmdate() with all possible arguments
+var_dump( gmdate($format, $timestamp) );
+
+// Calling gmdate() with mandatory arguments
+var_dump( gmdate($format) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : basic functionality ***
+string(24) "2008-08-08T08:08:08+0000"
+string(%d) "%s"
+===DONE===
diff --git a/ext/date/tests/gmdate_error.phpt b/ext/date/tests/gmdate_error.phpt
new file mode 100644
index 0000000000..fbee071269
--- /dev/null
+++ b/ext/date/tests/gmdate_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test gmdate() function : error conditions
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : error conditions ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$format = DATE_ISO8601;
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+// Zero arguments
+echo "\n-- Testing gmdate() function with Zero arguments --\n";
+var_dump( gmdate() );
+
+//Test gmdate with one more than the expected number of arguments
+echo "\n-- Testing gmdate() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( gmdate($format, $timestamp, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : error conditions ***
+
+-- Testing gmdate() function with Zero arguments --
+
+Warning: gmdate() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing gmdate() function with more than expected no. of arguments --
+
+Warning: gmdate() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmdate_variation1.phpt b/ext/date/tests/gmdate_variation1.phpt
new file mode 100644
index 0000000000..f6850ccd20
--- /dev/null
+++ b/ext/date/tests/gmdate_variation1.phpt
@@ -0,0 +1,221 @@
+--TEST--
+Test gmdate() function : usage variation - Passing unexpected values to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//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' => -12345,
+
+ // 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' => '',
+
+ // 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 format
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($value, $timestamp) );
+ var_dump( gmdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--int 0--
+string(1) "0"
+string(1) "0"
+
+--int 1--
+string(1) "1"
+string(1) "1"
+
+--int 12345--
+string(5) "12345"
+string(5) "12345"
+
+--int -12345--
+string(6) "-12345"
+string(6) "-12345"
+
+--float 10.5--
+string(4) "10.5"
+string(4) "10.5"
+
+--float -10.5--
+string(5) "-10.5"
+string(5) "-10.5"
+
+--float 12.3456789000e10--
+string(12) "123456789000"
+string(12) "123456789000"
+
+--float -12.3456789000e10--
+string(13) "-123456789000"
+string(13) "-123456789000"
+
+--float .5--
+string(3) "0.5"
+string(3) "0.5"
+
+--empty array--
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(0) ""
+string(0) ""
+
+--lowercase null--
+string(0) ""
+string(0) ""
+
+--lowercase true--
+string(1) "1"
+string(1) "1"
+
+--lowercase false--
+string(0) ""
+string(0) ""
+
+--uppercase TRUE--
+string(1) "1"
+string(1) "1"
+
+--uppercase FALSE--
+string(0) ""
+string(0) ""
+
+--empty string DQ--
+string(0) ""
+string(0) ""
+
+--empty string SQ--
+string(0) ""
+string(0) ""
+
+--instance of classWithToString--
+string(53) "CFridayam0808 AM 2008b8UTC2008-08-08T08:08:08+00:0031"
+string(%d) "%s"
+
+--instance of classWithoutToString--
+
+Warning: gmdate() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(0) ""
+string(0) ""
+
+--unset var--
+string(0) ""
+string(0) ""
+===DONE===
diff --git a/ext/date/tests/gmdate_variation10.phpt b/ext/date/tests/gmdate_variation10.phpt
new file mode 100644
index 0000000000..d5298368d3
--- /dev/null
+++ b/ext/date/tests/gmdate_variation10.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Timezone format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('Asia/Calcutta');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with Timezone identifier format --\n";
+var_dump( gmdate('e') );
+var_dump( gmdate('e', $timestamp) );
+
+echo "\n-- Testing gmdate() function with checking whether date is in daylight saving time format --\n";
+var_dump( gmdate('I') );
+var_dump( gmdate('I', $timestamp) );
+
+echo "\n-- Testing gmdate() function with difference to GMT in hours format --\n";
+var_dump( gmdate('O') );
+var_dump( gmdate('O', $timestamp) );
+
+echo "\n-- Testing gmdate() function with Difference to GMT in hours using colon as separator format --\n";
+var_dump( gmdate('P') );
+var_dump( gmdate('P', $timestamp) );
+
+echo "\n-- Testing gmdate() function with timezone abbreviation format --\n";
+var_dump( gmdate('T') );
+var_dump( gmdate('T', $timestamp) );
+
+echo "\n-- Testing gmdate() function with timezone offset format --\n";
+var_dump( gmdate('T') );
+var_dump( gmdate('T', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with Timezone identifier format --
+string(3) "UTC"
+string(3) "UTC"
+
+-- Testing gmdate() function with checking whether date is in daylight saving time format --
+string(1) "%d"
+string(1) "%d"
+
+-- Testing gmdate() function with difference to GMT in hours format --
+string(5) "+0000"
+string(5) "+0000"
+
+-- Testing gmdate() function with Difference to GMT in hours using colon as separator format --
+string(6) "+00:00"
+string(6) "+00:00"
+
+-- Testing gmdate() function with timezone abbreviation format --
+string(3) "GMT"
+string(3) "GMT"
+
+-- Testing gmdate() function with timezone offset format --
+string(3) "GMT"
+string(3) "GMT"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation11.phpt b/ext/date/tests/gmdate_variation11.phpt
new file mode 100644
index 0000000000..a9520907cb
--- /dev/null
+++ b/ext/date/tests/gmdate_variation11.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Full Date/Time format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with ISO 8601 date format --\n";
+var_dump( gmdate('c') );
+var_dump( gmdate('c', $timestamp) );
+
+echo "\n-- Testing gmdate() function with RFC 2822 date format --\n";
+var_dump( gmdate('r') );
+var_dump( gmdate('r', $timestamp) );
+
+echo "\n-- Testing gmdate() function with seconds since Unix Epoch format --\n";
+var_dump( gmdate('U') );
+var_dump( gmdate('U', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with ISO 8601 date format --
+string(%d) "%s"
+string(25) "2008-08-08T08:08:08+00:00"
+
+-- Testing gmdate() function with RFC 2822 date format --
+string(%d) "%s"
+string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
+
+-- Testing gmdate() function with seconds since Unix Epoch format --
+string(%d) "%d"
+string(10) "1218182888"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation12.phpt b/ext/date/tests/gmdate_variation12.phpt
new file mode 100644
index 0000000000..8f0146f384
--- /dev/null
+++ b/ext/date/tests/gmdate_variation12.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test gmdate() function : usage variation - Valid and invalid range of timestamp.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+
+$timestamp = mktime(20, 45, 54, 12, 13, 1901);
+echo "\n-- Testing gmdate() function with minimum range of timestamp --\n";
+var_dump( gmdate(DATE_ISO8601, $timestamp) );
+
+$timestamp = mktime(20, 45, 50, 12, 13, 1901);
+echo "\n-- Testing gmdate() function with less than the range of timestamp --\n";
+var_dump( gmdate(DATE_ISO8601, $timestamp) );
+
+echo "\n-- Testing gmdate() function with maximum range of timestamp --\n";
+$timestamp = mktime(03, 14, 07, 1, 19, 2038);
+var_dump( gmdate(DATE_ISO8601, $timestamp) );
+
+echo "\n-- Testing gmdate() function with greater than the range of timestamp --\n";
+$timestamp = mktime(03, 14, 10, 1, 19, 2038);
+var_dump( gmdate(DATE_ISO8601, $timestamp) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing gmdate\(\) : usage variation \*\*\*
+
+-- Testing gmdate\(\) function with minimum range of timestamp --
+string\(24\) "1901-12-13T20:45:54\+0000"
+
+-- Testing gmdate\(\) function with less than the range of timestamp --
+string\(24\) "(1970-01-01T00:00:00\+0000|1901-12-13T20:45:50\+0000)"
+
+-- Testing gmdate\(\) function with maximum range of timestamp --
+string\(24\) "2038-01-19T03:14:07\+0000"
+
+-- Testing gmdate\(\) function with greater than the range of timestamp --
+string\(24\) "(1970-01-01T00:00:00\+0000|2038-01-19T03:14:10\+0000)"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation13.phpt b/ext/date/tests/gmdate_variation13.phpt
new file mode 100644
index 0000000000..adc03919e8
--- /dev/null
+++ b/ext/date/tests/gmdate_variation13.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test gmdate() function : usage variation - Passing predefined constants to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ // Predefined Date constants
+ 'DATE_ATOM Constant' => DATE_ATOM,
+ 'DATE_COOKIE Constant' => DATE_COOKIE,
+ 'DATE_RFC822 Constant' => DATE_RFC822,
+ 'DATE_RFC850 Constant' => DATE_RFC850,
+ 'DATE_RFC1036 Constant' => DATE_RFC1036,
+ 'DATE_RFC1123 Constant' => DATE_RFC1123,
+ 'DATE_RFC2822 Constant' => DATE_RFC2822,
+ 'DATE_RFC3339 Constant' => DATE_RFC3339,
+ 'DATE_RSS Constant' => DATE_RSS,
+ 'DATE_W3C Constant' => DATE_W3C,
+);
+
+// loop through each element of the array for format
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($value, $timestamp) );
+ var_dump( gmdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--DATE_ATOM Constant--
+string(25) "2008-08-08T08:08:08+00:00"
+string(%d) "%s"
+
+--DATE_COOKIE Constant--
+string(30) "Friday, 08-Aug-08 08:08:08 GMT"
+string(%d) "%s"
+
+--DATE_RFC822 Constant--
+string(29) "Fri, 08 Aug 08 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_RFC850 Constant--
+string(30) "Friday, 08-Aug-08 08:08:08 GMT"
+string(%d) "%s"
+
+--DATE_RFC1036 Constant--
+string(29) "Fri, 08 Aug 08 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_RFC1123 Constant--
+string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_RFC2822 Constant--
+string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_RFC3339 Constant--
+string(25) "2008-08-08T08:08:08+00:00"
+string(%d) "%s"
+
+--DATE_RSS Constant--
+string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_W3C Constant--
+string(25) "2008-08-08T08:08:08+00:00"
+string(%d) "%s"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation14.phpt b/ext/date/tests/gmdate_variation14.phpt
new file mode 100644
index 0000000000..dfea054c64
--- /dev/null
+++ b/ext/date/tests/gmdate_variation14.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test gmdate() function : usage variation - Passing high positive and negetive float values to timestamp.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$format = DATE_ISO8601;
+
+echo "\n-- Testing gmdate() function with float 12.3456789000e10 to timestamp --\n";
+$timestamp = 12.3456789000e10;
+var_dump( gmdate($format, $timestamp) );
+
+echo "\n-- Testing gmdate() function with float -12.3456789000e10 to timestamp --\n";
+$timestamp = -12.3456789000e10;
+var_dump( gmdate($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing gmdate\(\) : usage variation \*\*\*
+
+-- Testing gmdate\(\) function with float 12.3456789000e10 to timestamp --
+string\((24|25)\) "(1935-03-26T04:50:16\+0000|5882-03-11T00:30:00\+0000)"
+
+-- Testing gmdate\(\) function with float -12.3456789000e10 to timestamp --
+string\((24|25)\) "(2004-10-08T19:09:44\+0000|1901-12-13T20:45:52\+0000|-1943-10-22T23:30:00\+0000)"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation2.phpt b/ext/date/tests/gmdate_variation2.phpt
new file mode 100644
index 0000000000..c52de9da75
--- /dev/null
+++ b/ext/date/tests/gmdate_variation2.phpt
@@ -0,0 +1,210 @@
+--TEST--
+Test gmdate() function : usage variation - Passing unexpected values to timestamp argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$format = DATE_ISO8601;
+
+//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' => -12345,
+
+ // 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( gmdate($format, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--int 0--
+string(24) "1970-01-01T00:00:00+0000"
+
+--int 1--
+string(24) "1970-01-01T00:00:01+0000"
+
+--int 12345--
+string(24) "1970-01-01T03:25:45+0000"
+
+--int -12345--
+string(24) "1969-12-31T20:34:15+0000"
+
+--float 10.5--
+string(24) "1970-01-01T00:00:10+0000"
+
+--float -10.5--
+string(24) "1969-12-31T23:59:50+0000"
+
+--float .5--
+string(24) "1970-01-01T00:00:00+0000"
+
+--empty array--
+
+Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(24) "1970-01-01T00:00:00+0000"
+
+--lowercase null--
+string(24) "1970-01-01T00:00:00+0000"
+
+--lowercase true--
+string(24) "1970-01-01T00:00:01+0000"
+
+--lowercase false--
+string(24) "1970-01-01T00:00:00+0000"
+
+--uppercase TRUE--
+string(24) "1970-01-01T00:00:01+0000"
+
+--uppercase FALSE--
+string(24) "1970-01-01T00:00:00+0000"
+
+--empty string DQ--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmdate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmdate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(24) "1970-01-01T00:00:00+0000"
+
+--unset var--
+string(24) "1970-01-01T00:00:00+0000"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation3.phpt b/ext/date/tests/gmdate_variation3.phpt
new file mode 100644
index 0000000000..a93d6e9239
--- /dev/null
+++ b/ext/date/tests/gmdate_variation3.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test gmdate() function : usage variation - Passing numeric representation of day formats.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+
+ 'Day with leading zeros' => 'd',
+ 'Day without leading zeros' => 'j',
+ 'ISO representation' => 'N',
+ 'Numeric representation of day' => 'w',
+ 'Day of the year' => 'z'
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($value) );
+ var_dump( gmdate($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--Day with leading zeros--
+string(%d) "%d"
+string(2) "08"
+
+--Day without leading zeros--
+string(%d) "%d"
+string(1) "8"
+
+--ISO representation--
+string(%d) "%d"
+string(1) "5"
+
+--Numeric representation of day--
+string(%d) "%d"
+string(1) "5"
+
+--Day of the year--
+string(%d) "%d"
+string(3) "220"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation4.phpt b/ext/date/tests/gmdate_variation4.phpt
new file mode 100644
index 0000000000..bb97b567c6
--- /dev/null
+++ b/ext/date/tests/gmdate_variation4.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test gmdate() function : usage variation - Passing textual representation of day formats.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with partial textual representation of day --\n";
+var_dump( gmdate('D') );
+var_dump( gmdate('D', $timestamp) );
+
+echo "\n-- Testing gmdate() function with full textual representation of day --\n";
+var_dump( gmdate('l') );
+var_dump( gmdate('l', $timestamp) );
+
+echo "\n-- Testing gmdate() function with English ordinal suffix --\n";
+var_dump( gmdate('S') );
+var_dump( gmdate('S', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with partial textual representation of day --
+string(%d) "%s"
+string(3) "Fri"
+
+-- Testing gmdate() function with full textual representation of day --
+string(%d) "%s"
+string(6) "Friday"
+
+-- Testing gmdate() function with English ordinal suffix --
+string(%d) "%s"
+string(2) "th"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation5.phpt b/ext/date/tests/gmdate_variation5.phpt
new file mode 100644
index 0000000000..d40488a692
--- /dev/null
+++ b/ext/date/tests/gmdate_variation5.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Week representation to format.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with ISO-8601 week number of year format --\n";
+var_dump( gmdate('W') );
+var_dump( gmdate('W', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with ISO-8601 week number of year format --
+string(%d) "%d"
+string(2) "32"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation6.phpt b/ext/date/tests/gmdate_variation6.phpt
new file mode 100644
index 0000000000..f5b63a5b3f
--- /dev/null
+++ b/ext/date/tests/gmdate_variation6.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Month format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with full textual representation of month format --\n";
+var_dump( gmdate('F') );
+var_dump( gmdate('F', $timestamp) );
+
+echo "\n-- Testing gmdate() function with numeric representation of month format --\n";
+var_dump( gmdate('m') );
+var_dump( gmdate('m', $timestamp) );
+
+echo "\n-- Testing gmdate() function with short textual representation of month format --\n";
+var_dump( gmdate('M') );
+var_dump( gmdate('M', $timestamp) );
+
+echo "\n-- Testing gmdate() function with numeric representation of month without leading zeros format --\n";
+var_dump( gmdate('n') );
+var_dump( gmdate('n', $timestamp) );
+
+echo "\n-- Testing gmdate() function with number of days in a month format --\n";
+var_dump( gmdate('t') );
+var_dump( gmdate('t', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with full textual representation of month format --
+string(%d) "%s"
+string(6) "August"
+
+-- Testing gmdate() function with numeric representation of month format --
+string(%d) "%d"
+string(2) "08"
+
+-- Testing gmdate() function with short textual representation of month format --
+string(%d) "%s"
+string(3) "Aug"
+
+-- Testing gmdate() function with numeric representation of month without leading zeros format --
+string(%d) "%d"
+string(1) "8"
+
+-- Testing gmdate() function with number of days in a month format --
+string(%d) "%d"
+string(2) "31"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation7.phpt b/ext/date/tests/gmdate_variation7.phpt
new file mode 100644
index 0000000000..8d9c1b0b97
--- /dev/null
+++ b/ext/date/tests/gmdate_variation7.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Year format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+$timestamp_non_leap_year = mktime(8, 8, 8, 8, 8, 2007);
+
+echo "\n-- Testing gmdate() function with checking non leap year using Leap Year format --\n";
+var_dump( gmdate('L', $timestamp_non_leap_year) );
+
+echo "\n-- Testing gmdate() function with checking leap year using Leap Year format --\n";
+var_dump( gmdate('L') );
+var_dump( gmdate('L', $timestamp) );
+
+echo "\n-- Testing gmdate() function with ISO-8601 year number format --\n";
+var_dump( gmdate('o') );
+var_dump( gmdate('o', $timestamp) );
+
+echo "\n-- Testing gmdate() function with full numeric representation of year format --\n";
+var_dump( gmdate('Y') );
+var_dump( gmdate('Y', $timestamp) );
+
+echo "\n-- Testing gmdate() function with 2 digit representation year format --\n";
+var_dump( gmdate('y') );
+var_dump( gmdate('y', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with checking non leap year using Leap Year format --
+string(1) "0"
+
+-- Testing gmdate() function with checking leap year using Leap Year format --
+string(1) "%d"
+string(1) "1"
+
+-- Testing gmdate() function with ISO-8601 year number format --
+string(4) "%d"
+string(4) "2008"
+
+-- Testing gmdate() function with full numeric representation of year format --
+string(4) "%d"
+string(4) "2008"
+
+-- Testing gmdate() function with 2 digit representation year format --
+string(2) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation8.phpt b/ext/date/tests/gmdate_variation8.phpt
new file mode 100644
index 0000000000..8d9c1b0b97
--- /dev/null
+++ b/ext/date/tests/gmdate_variation8.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Year format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+$timestamp_non_leap_year = mktime(8, 8, 8, 8, 8, 2007);
+
+echo "\n-- Testing gmdate() function with checking non leap year using Leap Year format --\n";
+var_dump( gmdate('L', $timestamp_non_leap_year) );
+
+echo "\n-- Testing gmdate() function with checking leap year using Leap Year format --\n";
+var_dump( gmdate('L') );
+var_dump( gmdate('L', $timestamp) );
+
+echo "\n-- Testing gmdate() function with ISO-8601 year number format --\n";
+var_dump( gmdate('o') );
+var_dump( gmdate('o', $timestamp) );
+
+echo "\n-- Testing gmdate() function with full numeric representation of year format --\n";
+var_dump( gmdate('Y') );
+var_dump( gmdate('Y', $timestamp) );
+
+echo "\n-- Testing gmdate() function with 2 digit representation year format --\n";
+var_dump( gmdate('y') );
+var_dump( gmdate('y', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with checking non leap year using Leap Year format --
+string(1) "0"
+
+-- Testing gmdate() function with checking leap year using Leap Year format --
+string(1) "%d"
+string(1) "1"
+
+-- Testing gmdate() function with ISO-8601 year number format --
+string(4) "%d"
+string(4) "2008"
+
+-- Testing gmdate() function with full numeric representation of year format --
+string(4) "%d"
+string(4) "2008"
+
+-- Testing gmdate() function with 2 digit representation year format --
+string(2) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation9.phpt b/ext/date/tests/gmdate_variation9.phpt
new file mode 100644
index 0000000000..e210557ace
--- /dev/null
+++ b/ext/date/tests/gmdate_variation9.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Time format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+$time_formats = array(
+
+ 'Lowercase Ante meridiem and post meridiem' => 'a',
+ 'Uppercase Ante meridiem and post meridiem' => 'a',
+ 'Swatch Internet time' => 'B',
+ '12-hour format without leading zeros' => 'g',
+ '24-hour format without leading zeros' => 'G',
+ '12-hour format with leading zeros' => 'h',
+ '24-hour format with leading zeros' => 'H',
+ 'Minutes with leading zeros' => 'i',
+ 'Seconds with leading zeros' => 's',
+ 'Milliseconds' => 'u',
+);
+
+foreach($time_formats as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($value) );
+ var_dump( gmdate($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--Lowercase Ante meridiem and post meridiem--
+string(2) "%s"
+string(2) "am"
+
+--Uppercase Ante meridiem and post meridiem--
+string(2) "%s"
+string(2) "am"
+
+--Swatch Internet time--
+string(%d) "%d"
+string(3) "380"
+
+--12-hour format without leading zeros--
+string(%d) "%d"
+string(1) "8"
+
+--24-hour format without leading zeros--
+string(%d) "%d"
+string(1) "8"
+
+--12-hour format with leading zeros--
+string(%d) "%d"
+string(2) "08"
+
+--24-hour format with leading zeros--
+string(2) "%d"
+string(2) "08"
+
+--Minutes with leading zeros--
+string(2) "%d"
+string(2) "08"
+
+--Seconds with leading zeros--
+string(2) "%d"
+string(2) "08"
+
+--Milliseconds--
+string(%d) "%d"
+string(6) "000000"
+===DONE===