From ccef11d68ffc9fbc5152680d9cd6aded9438e62e Mon Sep 17 00:00:00 2001 From: Sanjay Mantoor Date: Fri, 14 Nov 2008 09:16:00 +0000 Subject: [PATCH] New testcases for gmdate function --- ext/date/tests/gmdate_basic.phpt | 30 ++++ ext/date/tests/gmdate_error.phpt | 41 +++++ ext/date/tests/gmdate_variation1.phpt | 221 +++++++++++++++++++++++++ ext/date/tests/gmdate_variation10.phpt | 69 ++++++++ ext/date/tests/gmdate_variation11.phpt | 45 +++++ ext/date/tests/gmdate_variation12.phpt | 48 ++++++ ext/date/tests/gmdate_variation13.phpt | 82 +++++++++ ext/date/tests/gmdate_variation14.phpt | 34 ++++ ext/date/tests/gmdate_variation2.phpt | 210 +++++++++++++++++++++++ ext/date/tests/gmdate_variation3.phpt | 59 +++++++ ext/date/tests/gmdate_variation4.phpt | 45 +++++ ext/date/tests/gmdate_variation5.phpt | 29 ++++ ext/date/tests/gmdate_variation6.phpt | 61 +++++++ ext/date/tests/gmdate_variation7.phpt | 60 +++++++ ext/date/tests/gmdate_variation8.phpt | 60 +++++++ ext/date/tests/gmdate_variation9.phpt | 81 +++++++++ 16 files changed, 1175 insertions(+) create mode 100644 ext/date/tests/gmdate_basic.phpt create mode 100644 ext/date/tests/gmdate_error.phpt create mode 100644 ext/date/tests/gmdate_variation1.phpt create mode 100644 ext/date/tests/gmdate_variation10.phpt create mode 100644 ext/date/tests/gmdate_variation11.phpt create mode 100644 ext/date/tests/gmdate_variation12.phpt create mode 100644 ext/date/tests/gmdate_variation13.phpt create mode 100644 ext/date/tests/gmdate_variation14.phpt create mode 100644 ext/date/tests/gmdate_variation2.phpt create mode 100644 ext/date/tests/gmdate_variation3.phpt create mode 100644 ext/date/tests/gmdate_variation4.phpt create mode 100644 ext/date/tests/gmdate_variation5.phpt create mode 100644 ext/date/tests/gmdate_variation6.phpt create mode 100644 ext/date/tests/gmdate_variation7.phpt create mode 100644 ext/date/tests/gmdate_variation8.phpt create mode 100644 ext/date/tests/gmdate_variation9.phpt 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-- + +===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-- + +===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..e2e2331958 --- /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-- + 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-- + +===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-- + +===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-- + +===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..5a19ae268e --- /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-- + 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=== \ No newline at end of file diff --git a/ext/date/tests/gmdate_variation14.phpt b/ext/date/tests/gmdate_variation14.phpt new file mode 100644 index 0000000000..53dc647d05 --- /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-- + +===DONE=== +--EXPECTREGEX-- +\*\*\* Testing gmdate\(\) : usage variation \*\*\* + +-- Testing gmdate\(\) function with float 12.3456789000e10 to timestamp -- +string\((24|25)\) "(2038-01-19T03:14:07\+0000|5882-03-11T00:30:00\+0000)" + +-- Testing gmdate\(\) function with float -12.3456789000e10 to timestamp -- +string\((24|25)\) "(1901-12-13T20:45:52\+0000|-1943-10-22T23:30:00\+0000)" +===DONE=== \ No newline at end of file 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-- + 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-- + '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-- + +===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-- + +===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-- + +===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-- + +===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-- + +===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-- + '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=== -- 2.50.1