From 5b75dd317f21014eeed3bd8e0f5cee29029514fb Mon Sep 17 00:00:00 2001 From: Sanjay Mantoor Date: Wed, 21 Jan 2009 10:51:04 +0000 Subject: New testcases for strftime function --- ext/date/tests/strftime_basic.phpt | 30 +++++ ext/date/tests/strftime_error.phpt | 30 +++++ ext/date/tests/strftime_variation1.phpt | 222 +++++++++++++++++++++++++++++++ ext/date/tests/strftime_variation10.phpt | 50 +++++++ ext/date/tests/strftime_variation11.phpt | 37 ++++++ ext/date/tests/strftime_variation12.phpt | 37 ++++++ ext/date/tests/strftime_variation13.phpt | 60 +++++++++ ext/date/tests/strftime_variation14.phpt | 60 +++++++++ ext/date/tests/strftime_variation15.phpt | 55 ++++++++ ext/date/tests/strftime_variation16.phpt | 55 ++++++++ ext/date/tests/strftime_variation17.phpt | 36 +++++ ext/date/tests/strftime_variation18.phpt | 36 +++++ ext/date/tests/strftime_variation19.phpt | 50 +++++++ ext/date/tests/strftime_variation2.phpt | 191 ++++++++++++++++++++++++++ ext/date/tests/strftime_variation20.phpt | 52 ++++++++ ext/date/tests/strftime_variation21.phpt | 55 ++++++++ ext/date/tests/strftime_variation22.phpt | 55 ++++++++ ext/date/tests/strftime_variation23.phpt | 36 +++++ ext/date/tests/strftime_variation3.phpt | 52 ++++++++ ext/date/tests/strftime_variation4.phpt | 48 +++++++ ext/date/tests/strftime_variation5.phpt | 50 +++++++ ext/date/tests/strftime_variation6.phpt | 60 +++++++++ ext/date/tests/strftime_variation7.phpt | 50 +++++++ ext/date/tests/strftime_variation8.phpt | 31 +++++ ext/date/tests/strftime_variation9.phpt | 50 +++++++ 25 files changed, 1488 insertions(+) create mode 100644 ext/date/tests/strftime_basic.phpt create mode 100644 ext/date/tests/strftime_error.phpt create mode 100644 ext/date/tests/strftime_variation1.phpt create mode 100644 ext/date/tests/strftime_variation10.phpt create mode 100644 ext/date/tests/strftime_variation11.phpt create mode 100644 ext/date/tests/strftime_variation12.phpt create mode 100644 ext/date/tests/strftime_variation13.phpt create mode 100644 ext/date/tests/strftime_variation14.phpt create mode 100644 ext/date/tests/strftime_variation15.phpt create mode 100644 ext/date/tests/strftime_variation16.phpt create mode 100644 ext/date/tests/strftime_variation17.phpt create mode 100644 ext/date/tests/strftime_variation18.phpt create mode 100644 ext/date/tests/strftime_variation19.phpt create mode 100644 ext/date/tests/strftime_variation2.phpt create mode 100644 ext/date/tests/strftime_variation20.phpt create mode 100644 ext/date/tests/strftime_variation21.phpt create mode 100644 ext/date/tests/strftime_variation22.phpt create mode 100644 ext/date/tests/strftime_variation23.phpt create mode 100644 ext/date/tests/strftime_variation3.phpt create mode 100644 ext/date/tests/strftime_variation4.phpt create mode 100644 ext/date/tests/strftime_variation5.phpt create mode 100644 ext/date/tests/strftime_variation6.phpt create mode 100644 ext/date/tests/strftime_variation7.phpt create mode 100644 ext/date/tests/strftime_variation8.phpt create mode 100644 ext/date/tests/strftime_variation9.phpt (limited to 'ext/date') diff --git a/ext/date/tests/strftime_basic.phpt b/ext/date/tests/strftime_basic.phpt new file mode 100644 index 0000000000..07f22af823 --- /dev/null +++ b/ext/date/tests/strftime_basic.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test strftime() function : basic functionality +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strftime() : basic functionality *** +string(20) "Aug 08 2008 08:08:08" +string(%d) "%s %d %d %d:%d:%d" +===DONE=== diff --git a/ext/date/tests/strftime_error.phpt b/ext/date/tests/strftime_error.phpt new file mode 100644 index 0000000000..19663798e3 --- /dev/null +++ b/ext/date/tests/strftime_error.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test strftime() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strftime() : error conditions *** + +-- Testing strftime() function with more than expected no. of arguments -- + +Warning: strftime() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +===DONE=== diff --git a/ext/date/tests/strftime_variation1.phpt b/ext/date/tests/strftime_variation1.phpt new file mode 100644 index 0000000000..04b4819fe5 --- /dev/null +++ b/ext/date/tests/strftime_variation1.phpt @@ -0,0 +1,222 @@ +--TEST-- +Test strftime() function : usage variation - Passing unexpected values to first argument 'format'. +--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( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : 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: strftime() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strftime() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +--int indexed array-- + +Warning: strftime() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strftime() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +--associative array-- + +Warning: strftime() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strftime() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +--nested arrays-- + +Warning: strftime() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strftime() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +--uppercase NULL-- +bool(false) +bool(false) + +--lowercase null-- +bool(false) +bool(false) + +--lowercase true-- +string(1) "1" +string(1) "1" + +--lowercase false-- +bool(false) +bool(false) + +--uppercase TRUE-- +string(1) "1" +string(1) "1" + +--uppercase FALSE-- +bool(false) +bool(false) + +--empty string DQ-- +bool(false) +bool(false) + +--empty string SQ-- +bool(false) +bool(false) + +--instance of classWithToString-- +string(14) "Class A object" +string(14) "Class A object" + +--instance of classWithoutToString-- + +Warning: strftime() expects parameter 1 to be string, object given in %s on line %d +bool(false) + +Warning: strftime() expects parameter 1 to be string, object given in %s on line %d +bool(false) + +--undefined var-- +bool(false) +bool(false) + +--unset var-- +bool(false) +bool(false) +===DONE=== diff --git a/ext/date/tests/strftime_variation10.phpt b/ext/date/tests/strftime_variation10.phpt new file mode 100644 index 0000000000..7d2a1b8fcd --- /dev/null +++ b/ext/date/tests/strftime_variation10.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test strftime() function : usage variation - Checking week related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + "%V", + 'Weekday as decimal' => "%u", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--The ISO 8601:1988 week number-- +string(%d) "%d" +string(2) "32" + +--Weekday as decimal-- +string(%d) "%d" +string(1) "5" +===DONE=== diff --git a/ext/date/tests/strftime_variation11.phpt b/ext/date/tests/strftime_variation11.phpt new file mode 100644 index 0000000000..a063f0ad20 --- /dev/null +++ b/ext/date/tests/strftime_variation11.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test strftime() function : usage variation - Checking month related formats which are not supported on Windows. +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +-- Testing strftime() function with Abbreviated month name format %h -- +bool(false) +bool(false) +===DONE=== diff --git a/ext/date/tests/strftime_variation12.phpt b/ext/date/tests/strftime_variation12.phpt new file mode 100644 index 0000000000..b798f428f6 --- /dev/null +++ b/ext/date/tests/strftime_variation12.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test strftime() function : usage variation - Checking month related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +-- Testing strftime() function with Abbreviated month name format %h -- +string(%d) "%s" +string(3) "Aug" +===DONE=== diff --git a/ext/date/tests/strftime_variation13.phpt b/ext/date/tests/strftime_variation13.phpt new file mode 100644 index 0000000000..58ad283ffd --- /dev/null +++ b/ext/date/tests/strftime_variation13.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test strftime() function : usage variation - Checking date related formats which are not supported on Windows. +--SKIPIF-- + +--FILE-- + "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Century number-- +bool(false) +bool(false) + +--Month Date Year-- +bool(false) +bool(false) + +--Year with century-- +bool(false) +bool(false) + +--Year without century-- +bool(false) +bool(false) +===DONE=== diff --git a/ext/date/tests/strftime_variation14.phpt b/ext/date/tests/strftime_variation14.phpt new file mode 100644 index 0000000000..7ccb7d283d --- /dev/null +++ b/ext/date/tests/strftime_variation14.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test strftime() function : usage variation - Checking date related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Century number-- +string(%d) "%d" +string(2) "20" + +--Month Date Year-- +string(%d) "%d/%d/%d" +string(8) "08/08/08" + +--Year with century-- +string(%d) "%d" +string(4) "2008" + +--Year without century-- +string(%d) "%d" +string(2) "08" +===DONE=== diff --git a/ext/date/tests/strftime_variation15.phpt b/ext/date/tests/strftime_variation15.phpt new file mode 100644 index 0000000000..5b2946bf5d --- /dev/null +++ b/ext/date/tests/strftime_variation15.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test strftime() function : usage variation - Checking time related formats which are not supported on Windows. +--SKIPIF-- + +--FILE-- + "%r", + 'Time in 24 hour notation' => "%R", + 'Current time %H:%M:%S format' => "%T", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Time in a.m/p.m notation-- +bool(false) +bool(false) + +--Time in 24 hour notation-- +bool(false) +bool(false) + +--Current time %H:%M:%S format-- +bool(false) +bool(false) +===DONE=== diff --git a/ext/date/tests/strftime_variation16.phpt b/ext/date/tests/strftime_variation16.phpt new file mode 100644 index 0000000000..5103b3add8 --- /dev/null +++ b/ext/date/tests/strftime_variation16.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test strftime() function : usage variation - Checking time related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + "%r", + 'Time in 24 hour notation' => "%R", + 'Current time %H:%M:%S format' => "%T", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Time in a.m/p.m notation-- +string(%d) "%d:%d:%d %s" +string(11) "08:08:08 AM" + +--Time in 24 hour notation-- +string(%d) "%d:%d" +string(5) "08:08" + +--Current time %H:%M:%S format-- +string(%d) "%d:%d:%d" +string(8) "08:08:08" +===DONE=== diff --git a/ext/date/tests/strftime_variation17.phpt b/ext/date/tests/strftime_variation17.phpt new file mode 100644 index 0000000000..90b3269e83 --- /dev/null +++ b/ext/date/tests/strftime_variation17.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test strftime() function : usage variation - Checking day related formats which are not supported on Windows. +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +-- Testing strftime() function with Day of the month as decimal single digit format -- +bool(false) +bool(false) +===DONE=== diff --git a/ext/date/tests/strftime_variation18.phpt b/ext/date/tests/strftime_variation18.phpt new file mode 100644 index 0000000000..357b1a48f0 --- /dev/null +++ b/ext/date/tests/strftime_variation18.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test strftime() function : usage variation - Checking day related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +-- Testing strftime() function with Day of the month as decimal single digit format -- +string(%d) "%d" +string(2) " 8" +===DONE=== diff --git a/ext/date/tests/strftime_variation19.phpt b/ext/date/tests/strftime_variation19.phpt new file mode 100644 index 0000000000..b41607719c --- /dev/null +++ b/ext/date/tests/strftime_variation19.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test strftime() function : usage variation - Checking newline and tab formats which are not supported on Windows. +--SKIPIF-- + +--FILE-- + "%n", + 'Tab character' => "%t" +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Newline character-- +bool(false) +bool(false) + +--Tab character-- +bool(false) +bool(false) +===DONE=== diff --git a/ext/date/tests/strftime_variation2.phpt b/ext/date/tests/strftime_variation2.phpt new file mode 100644 index 0000000000..b02423495b --- /dev/null +++ b/ext/date/tests/strftime_variation2.phpt @@ -0,0 +1,191 @@ +--TEST-- +Test strftime() function : usage variation - Passing unexpected values to second argument 'timestamp'. +--FILE-- + 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( strftime($format, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--float 10.5-- +string(20) "Jan 01 1970 05:30:10" + +--float -10.5-- +string(20) "Jan 01 1970 05:29:50" + +--float .5-- +string(20) "Jan 01 1970 05:30:00" + +--empty array-- + +Warning: strftime() expects parameter 2 to be long, array given in %s on line %d +bool(false) + +--int indexed array-- + +Warning: strftime() expects parameter 2 to be long, array given in %s on line %d +bool(false) + +--associative array-- + +Warning: strftime() expects parameter 2 to be long, array given in %s on line %d +bool(false) + +--nested arrays-- + +Warning: strftime() expects parameter 2 to be long, array given in %s on line %d +bool(false) + +--uppercase NULL-- +string(20) "Jan 01 1970 05:30:00" + +--lowercase null-- +string(20) "Jan 01 1970 05:30:00" + +--lowercase true-- +string(20) "Jan 01 1970 05:30:01" + +--lowercase false-- +string(20) "Jan 01 1970 05:30:00" + +--uppercase TRUE-- +string(20) "Jan 01 1970 05:30:01" + +--uppercase FALSE-- +string(20) "Jan 01 1970 05:30:00" + +--empty string DQ-- + +Warning: strftime() expects parameter 2 to be long, string given in %s on line %d +bool(false) + +--empty string SQ-- + +Warning: strftime() expects parameter 2 to be long, string given in %s on line %d +bool(false) + +--string DQ-- + +Warning: strftime() expects parameter 2 to be long, string given in %s on line %d +bool(false) + +--string SQ-- + +Warning: strftime() expects parameter 2 to be long, string given in %s on line %d +bool(false) + +--mixed case string-- + +Warning: strftime() expects parameter 2 to be long, string given in %s on line %d +bool(false) + +--heredoc-- + +Warning: strftime() expects parameter 2 to be long, string given in %s on line %d +bool(false) + +--instance of classWithToString-- + +Warning: strftime() expects parameter 2 to be long, object given in %s on line %d +bool(false) + +--instance of classWithoutToString-- + +Warning: strftime() expects parameter 2 to be long, object given in %s on line %d +bool(false) + +--undefined var-- +string(20) "Jan 01 1970 05:30:00" + +--unset var-- +string(20) "Jan 01 1970 05:30:00" +===DONE=== diff --git a/ext/date/tests/strftime_variation20.phpt b/ext/date/tests/strftime_variation20.phpt new file mode 100644 index 0000000000..336c6d2afb --- /dev/null +++ b/ext/date/tests/strftime_variation20.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test strftime() function : usage variation - Checking newline and tab formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + "%n", + 'Tab character' => "%t" +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTREGEX-- +\*\*\* Testing strftime\(\) : usage variation \*\*\* + +--Newline character-- +string\(1\) " +" +string\(1\) " +" + +--Tab character-- +string\(1\) "\s" +string\(1\) "\s" +===DONE=== diff --git a/ext/date/tests/strftime_variation21.phpt b/ext/date/tests/strftime_variation21.phpt new file mode 100644 index 0000000000..f6aed15eff --- /dev/null +++ b/ext/date/tests/strftime_variation21.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test strftime() function : usage variation - Checking Preferred date and time representation on Windows. +--SKIPIF-- + +--FILE-- + "%c", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Preferred date and time representation-- +string(%d) "%d/%d/%d %d:%d:%d" +string(17) "08/08/08 08:08:08" + +--Preferred date representation-- +string(%d) "%d/%d/%d" +string(8) "08/08/08" + +--Preferred time representation-- +string(%d) "%d:%d:%d" +string(8) "08:08:08" +===DONE=== diff --git a/ext/date/tests/strftime_variation22.phpt b/ext/date/tests/strftime_variation22.phpt new file mode 100644 index 0000000000..8ea259caf8 --- /dev/null +++ b/ext/date/tests/strftime_variation22.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test strftime() function : usage variation - Checking Preferred date and time representation other than on Windows. +--SKIPIF-- + +--FILE-- + "%c", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Preferred date and time representation-- +string(%d) "%s %d %s %d %d:%d:%d %s %s" +string(31) "Fri 08 Aug 2008 08:08:08 AM IST" + +--Preferred date representation-- +string(%d) "%d/%d/%d" +string(10) "08/08/2008" + +--Preferred time representation-- +string(%d) "%d:%d:%d %s" +string(11) "08:08:08 AM" +===DONE=== diff --git a/ext/date/tests/strftime_variation23.phpt b/ext/date/tests/strftime_variation23.phpt new file mode 100644 index 0000000000..34e14cf2f9 --- /dev/null +++ b/ext/date/tests/strftime_variation23.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test strftime() function : usage variation - Checking large positive and negative float values to timestamp. +--FILE-- + +===DONE=== +--EXPECTREGEX-- +\*\*\* Testing strftime\(\) : usage variation \*\*\* + +-- Testing strftime\(\) function with float 12.3456789000e10 to timestamp -- +string\(\d*\)\s"(Jan|Mar)\s(19|11)\s(2038|5882)\s(03|00):(14|30):(07|00)" + +-- Testing strftime\(\) function with float -12.3456789000e10 to timestamp -- +string\(\d*\)\s"(Dec|Oct)\s(13|22)\s(1901|-1943)\s(20|23):(45|30):(52|00)" +===DONE=== diff --git a/ext/date/tests/strftime_variation3.phpt b/ext/date/tests/strftime_variation3.phpt new file mode 100644 index 0000000000..342cb76925 --- /dev/null +++ b/ext/date/tests/strftime_variation3.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test strftime() function : usage variation - Passing week related format strings to format argument. +--FILE-- + "%a", + 'Full weekday name' => "%A", + 'Week number of the year' => "%U", + 'Week number of the year in decimal number' => "%W", +); +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Abbreviated weekday name-- +string(%d) "%s" +string(3) "Fri" + +--Full weekday name-- +string(%d) "%s" +string(6) "Friday" + +--Week number of the year-- +string(%d) "%d" +string(2) "31" + +--Week number of the year in decimal number-- +string(%d) "%d" +string(2) "31" +===DONE=== diff --git a/ext/date/tests/strftime_variation4.phpt b/ext/date/tests/strftime_variation4.phpt new file mode 100644 index 0000000000..6236dd9e7f --- /dev/null +++ b/ext/date/tests/strftime_variation4.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test strftime() function : usage variation - Passing month related format strings to format argument. +--FILE-- + "%b", + 'Full month name' => "%B", + 'Month as decimal' => "%m", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Abbreviated month name-- +string(%d) "%s" +string(3) "Aug" + +--Full month name-- +string(%d) "%s" +string(6) "August" + +--Month as decimal-- +string(%d) "%d" +string(2) "08" +===DONE=== diff --git a/ext/date/tests/strftime_variation5.phpt b/ext/date/tests/strftime_variation5.phpt new file mode 100644 index 0000000000..90f4e37ba3 --- /dev/null +++ b/ext/date/tests/strftime_variation5.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test strftime() function : usage variation - Passing date related format strings to format argument. +--FILE-- + "%y", + 'Year as decimal number including the century' => "%Y", + 'Time zone offset' => "%Z", + 'Time zone offset' => "%z", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Year as decimal number without a century-- +string(%d) "%d" +string(2) "08" + +--Year as decimal number including the century-- +string(%d) "%d" +string(4) "2008" + +--Time zone offset-- +string(%d) "%s" +string(%d) "%s" +===DONE=== diff --git a/ext/date/tests/strftime_variation6.phpt b/ext/date/tests/strftime_variation6.phpt new file mode 100644 index 0000000000..6713a198e9 --- /dev/null +++ b/ext/date/tests/strftime_variation6.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test strftime() function : usage variation - Passing time related format strings to format argument. +--FILE-- + "%H", + 'Hour as decimal by 12-hour format' => "%I", + 'Minute as decimal number' => "%M", + 'AM/PM format for a time' => "%p", + 'Second as decimal number' => "%S", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Hour as decimal by 24-hour format-- +string(%d) "%d" +string(2) "18" + +--Hour as decimal by 12-hour format-- +string(%d) "%d" +string(2) "06" + +--Minute as decimal number-- +string(%d) "%d" +string(2) "08" + +--AM/PM format for a time-- +string(%d) "%s" +string(2) "PM" + +--Second as decimal number-- +string(%d) "%d" +string(2) "08" +===DONE=== diff --git a/ext/date/tests/strftime_variation7.phpt b/ext/date/tests/strftime_variation7.phpt new file mode 100644 index 0000000000..67fd416ac0 --- /dev/null +++ b/ext/date/tests/strftime_variation7.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test strftime() function : usage variation - Passing day related format strings to format argument. +--FILE-- + "%d", + 'Day of the year as a decimal number' => "%j", + 'Day of the week as a decimal number' => "%w" +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Day of the month as a decimal number-- +string(%d) "%d" +string(2) "08" + +--Day of the year as a decimal number-- +string(%d) "%d" +string(3) "221" + +--Day of the week as a decimal number-- +string(%d) "%d" +string(1) "5" +===DONE=== diff --git a/ext/date/tests/strftime_variation8.phpt b/ext/date/tests/strftime_variation8.phpt new file mode 100644 index 0000000000..af8089f980 --- /dev/null +++ b/ext/date/tests/strftime_variation8.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test strftime() function : usage variation - Passing literal related strings to format argument. +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +-- Testing strftime() function with a literal % character to format -- +string(1) "%" +string(1) "%" +===DONE=== diff --git a/ext/date/tests/strftime_variation9.phpt b/ext/date/tests/strftime_variation9.phpt new file mode 100644 index 0000000000..23aa92d98d --- /dev/null +++ b/ext/date/tests/strftime_variation9.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test strftime() function : usage variation - Checking week related formats which are not supported on Windows. +--SKIPIF-- + +--FILE-- + "%V", + 'Weekday as decimal' => "%u", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--The ISO 8601:1988 week number-- +bool(false) +bool(false) + +--Weekday as decimal-- +bool(false) +bool(false) +===DONE=== -- cgit v1.2.1