cvs: php-src /ext/date/tests getdate_basic.phpt getdate_error.phpt getdate_variation1.phpt getdate_variation2.phpt getdate_variation3.phpt
getdate_variation4.phpt getdate_variation5.phpt getdate_variation6.phpt getdate_variation7.phpt gmstrftime_basic.phpt gmstrftime_error.phpt
gmstrftime_variation1.phpt gmstrftime_variation10.phpt gmstrftime_variation11.phpt gmstrftime_variation12.phpt gmstrftime_variation13.phpt
gmstrftime_variation14.phpt gmstrftime_variation15.phpt gmstrftime_variation16.phpt gmstrftime_variation17.phpt gmstrftime_variation18.phpt
gmstrftime_variation19.phpt gmstrftime_variation2.phpt gmstrftime_variation20.phpt gmstrftime_variation21.phpt gmstrftime_variation22.phpt
gmstrftime_variation3.phpt gmstrftime_variation4.phpt gmstrftime_variation5.phpt gmstrftime_variation6.phpt gmstrftime_variation7.phpt
gmstrftime_variation8.phpt gmstrftime_variation9.phpt

From: Date: Thu, 22 Jan 2009 18:47:25 +0000
Subject: cvs: php-src /ext/date/tests getdate_basic.phpt getdate_error.phpt getdate_variation1.phpt getdate_variation2.phpt getdate_variation3.phpt
getdate_variation4.phpt getdate_variation5.phpt getdate_variation6.phpt getdate_variation7.phpt gmstrftime_basic.phpt gmstrftime_error.phpt
gmstrftime_variation1.phpt gmstrftime_variation10.phpt gmstrftime_variation11.phpt gmstrftime_variation12.phpt gmstrftime_variation13.phpt
gmstrftime_variation14.phpt gmstrftime_variation15.phpt gmstrftime_variation16.phpt gmstrftime_variation17.phpt gmstrftime_variation18.phpt
gmstrftime_variation19.phpt gmstrftime_variation2.phpt gmstrftime_variation20.phpt gmstrftime_variation21.phpt gmstrftime_variation22.phpt
gmstrftime_variation3.phpt gmstrftime_variation4.phpt gmstrftime_variation5.phpt gmstrftime_variation6.phpt gmstrftime_variation7.phpt
gmstrftime_variation8.phpt gmstrftime_variation9.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-55866@lists.php.net to get a copy of this message
wharmby Thu Jan 22 18:47:25 2009 UTC Modified files: /php-src/ext/date/tests getdate_error.phpt gmstrftime_variation11.phpt gmstrftime_basic.phpt gmstrftime_variation19.phpt gmstrftime_variation8.phpt gmstrftime_variation22.phpt gmstrftime_variation13.phpt gmstrftime_variation16.phpt gmstrftime_variation6.phpt gmstrftime_variation1.phpt gmstrftime_variation4.phpt gmstrftime_variation5.phpt getdate_basic.phpt getdate_variation3.phpt gmstrftime_variation15.phpt getdate_variation4.phpt gmstrftime_variation14.phpt getdate_variation7.phpt getdate_variation2.phpt gmstrftime_variation2.phpt gmstrftime_variation9.phpt getdate_variation6.phpt gmstrftime_variation18.phpt gmstrftime_variation3.phpt gmstrftime_variation20.phpt gmstrftime_variation12.phpt gmstrftime_variation21.phpt gmstrftime_variation7.phpt gmstrftime_variation10.phpt getdate_variation5.phpt gmstrftime_error.phpt gmstrftime_variation17.phpt getdate_variation1.phpt Log: New date tests for getdate() and gmstrftime(). Tested on WIndows, Linux and Linux 64 bit

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/getdate_error.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/getdate_error.phpt diff -u /dev/null php-src/ext/date/tests/getdate_error.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/getdate_error.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,31 @@ +--TEST-- +Test getdate() function : error conditions +--FILE-- +<?php +/* Prototype : array getdate([int timestamp]) + * Description: Get date/time information + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing getdate() : error conditions ***\n"; + +//Set the default time zone +date_default_timezone_set("America/Chicago"); + +//Test getdate with one more than the expected number of arguments +echo "\n-- Testing getdate() function with more than expected no. of arguments --\n"; +$timestamp = 10; +$extra_arg = 10; +var_dump( getdate($timestamp, $extra_arg) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing getdate() : error conditions *** + +-- Testing getdate() function with more than expected no. of arguments -- + +Warning: getdate() expects at most 1 parameter, 2 given in %s on line %d +bool(false) +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation11.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation11.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation11.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation11.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,37 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking month related formats which are not supported on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { + die("skip Test is valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +echo "\n-- Testing gmstrftime() function with Abbreviated month name format %h --\n"; +$format = "%h"; +var_dump( gmstrftime($format) ); +var_dump( gmstrftime($format, $timestamp) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +-- Testing gmstrftime() function with Abbreviated month name format %h -- +bool(false) +bool(false) +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_basic.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_basic.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_basic.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,29 @@ +--TEST-- +Test gmstrftime() function : basic functionality +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : basic functionality ***\n"; + +// Initialise all required variables +$format = '%b %d %Y %H:%M:%S'; +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); + +// Calling gmstrftime() with all possible arguments +var_dump( gmstrftime($format, $timestamp) ); + +// Calling gmstrftime() with mandatory arguments +var_dump( gmstrftime($format) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : basic functionality *** +unicode(20) "Aug 08 2008 08:08:08" +unicode(%d) "%s %d %d %d:%d:%d" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation19.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation19.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation19.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation19.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,50 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking newline and tab formats which are not supported on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { + die("skip Test is valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + 'Newline character' => "%n", + 'Tab character' => "%t" +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Newline character-- +bool(false) +bool(false) + +--Tab character-- +bool(false) +bool(false) +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation8.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation8.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation8.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation8.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,39 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing literal related strings to format argument. +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + 'A literal % character' => "%%", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--A literal % character-- +unicode(1) "%" +unicode(1) "%" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation22.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation22.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation22.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation22.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,55 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking Preferred date and time representation other than on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { + die("skip Test is not valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + 'Preferred date and time representation' => "%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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Preferred date and time representation-- +unicode(%d) "%s %s %d %d:%d:%d %d" +unicode(24) "Fri Aug 8 08:08:08 2008" + +--Preferred date representation-- +unicode(%d) "%d/%d/%d" +unicode(8) "08/08/08" + +--Preferred time representation-- +unicode(%d) "%d:%d:%d" +unicode(8) "08:08:08" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation13.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation13.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation13.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation13.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,60 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking date related formats which are not supported on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { + die("skip Test is valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + 'Century number' => "%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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : 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=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation16.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation16.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation16.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation16.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,55 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking time related formats which are supported other than on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { + die("skip Test is not valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(14, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + 'Time in a.m/p.m notation' => "%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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Time in a.m/p.m notation-- +unicode(%d) "%d:%d:%d %s" +unicode(11) "02:08:08 PM" + +--Time in 24 hour notation-- +unicode(%d) "%d:%d" +unicode(5) "14:08" + +--Current time %H:%M:%S format-- +unicode(%d) "%d:%d:%d" +unicode(8) "14:08:08" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation6.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation6.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation6.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation6.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,59 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing time related format strings to format argument. +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + 'Hour as decimal by 24-hour format' => "%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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Hour as decimal by 24-hour format-- +unicode(2) "%d" +unicode(2) "08" + +--Hour as decimal by 12-hour format-- +unicode(2) "%d" +unicode(2) "08" + +--Minute as decimal number-- +unicode(%d) "%d" +unicode(2) "08" + +--AM/PM format for a time-- +unicode(2) "%s" +unicode(2) "AM" + +--Second as decimal number-- +unicode(%d) "%d" +unicode(2) "08" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation1.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation1.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation1.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation1.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,220 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing unexpected values to first argument 'format'. +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--int 0-- +unicode(1) "0" +unicode(1) "0" + +--int 1-- +unicode(1) "1" +unicode(1) "1" + +--int 12345-- +unicode(5) "12345" +unicode(5) "12345" + +--int -12345-- +unicode(6) "-12345" +unicode(6) "-12345" + +--float 10.5-- +unicode(4) "10.5" +unicode(4) "10.5" + +--float -10.5-- +unicode(5) "-10.5" +unicode(5) "-10.5" + +--float 12.3456789000e10-- +unicode(12) "123456789000" +unicode(12) "123456789000" + +--float -12.3456789000e10-- +unicode(13) "-123456789000" +unicode(13) "-123456789000" + +--float .5-- +unicode(3) "0.5" +unicode(3) "0.5" + +--empty array-- + +Warning: gmstrftime() expects parameter 1 to be binary string, array given in %s on line %d +bool(false) + +Warning: gmstrftime() expects parameter 1 to be binary string, array given in %s on line %d +bool(false) + +--int indexed array-- + +Warning: gmstrftime() expects parameter 1 to be binary string, array given in %s on line %d +bool(false) + +Warning: gmstrftime() expects parameter 1 to be binary string, array given in %s on line %d +bool(false) + +--associative array-- + +Warning: gmstrftime() expects parameter 1 to be binary string, array given in %s on line %d +bool(false) + +Warning: gmstrftime() expects parameter 1 to be binary string, array given in %s on line %d +bool(false) + +--nested arrays-- + +Warning: gmstrftime() expects parameter 1 to be binary string, array given in %s on line %d +bool(false) + +Warning: gmstrftime() expects parameter 1 to be binary string, array given in %s on line %d +bool(false) + +--uppercase NULL-- +bool(false) +bool(false) + +--lowercase null-- +bool(false) +bool(false) + +--lowercase true-- +unicode(1) "1" +unicode(1) "1" + +--lowercase false-- +bool(false) +bool(false) + +--uppercase TRUE-- +unicode(1) "1" +unicode(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-- +unicode(14) "Class A object" +unicode(14) "Class A object" + +--instance of classWithoutToString-- + +Warning: gmstrftime() expects parameter 1 to be binary string, object given in %s on line %d +bool(false) + +Warning: gmstrftime() expects parameter 1 to be binary string, object given in %s on line %d +bool(false) + +--undefined var-- +bool(false) +bool(false) + +--unset var-- +bool(false) +bool(false) +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation4.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation4.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation4.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation4.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,47 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing month related format strings to format argument. +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); + +//array of values to iterate over +$inputs = array( + 'Abbreviated month name' => "%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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Abbreviated month name-- +unicode(%d) "%s" +unicode(3) "Aug" + +--Full month name-- +unicode(%d) "%s" +unicode(6) "August" + +--Month as decimal-- +unicode(%d) "%d" +unicode(2) "08" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation5.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation5.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation5.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation5.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,51 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing date related format strings to format argument. +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + + +//array of values to iterate over +$inputs = array( + 'Year as decimal number without a century' => "%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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Year as decimal number without a century-- +unicode(%d) "%d" +unicode(2) "08" + +--Year as decimal number including the century-- +unicode(%d) "%d" +unicode(4) "2008" + +--Time zone offset-- +unicode(%s) "%s" +unicode(%s) "%s" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/getdate_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/getdate_basic.phpt diff -u /dev/null php-src/ext/date/tests/getdate_basic.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/getdate_basic.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,76 @@ +--TEST-- +Test getdate() function : basic functionality +--FILE-- +<?php +/* Prototype : array getdate([int timestamp]) + * Description: Get date/time information + * Source code: ext/date/php_date.c + */ + +echo "*** Testing getdate() : basic functionality ***\n"; + +//Set the default time zone +date_default_timezone_set("Asia/Calcutta"); + +// Initialise all required variables +$timestamp = 10; + +// Calling getdate() with all possible arguments +var_dump( getdate($timestamp) ); + +// Calling getdate() with mandatory arguments +var_dump( getdate() ); + +?> +===DONE=== +--EXPECTF-- +*** Testing getdate() : basic functionality *** +array(11) { + [u"seconds"]=> + int(10) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(10) +} +array(11) { + [u"seconds"]=> + int(%d) + [u"minutes"]=> + int(%d) + [u"hours"]=> + int(%d) + [u"mday"]=> + int(%d) + [u"wday"]=> + int(%d) + [u"mon"]=> + int(%d) + [u"year"]=> + int(%d) + [u"yday"]=> + int(%d) + [u"weekday"]=> + unicode(%d) %s + [u"month"]=> + unicode(%d) %s + [0]=> + int(%d) +} +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/getdate_variation3.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/getdate_variation3.phpt diff -u /dev/null php-src/ext/date/tests/getdate_variation3.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/getdate_variation3.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,114 @@ +--TEST-- +Test getdate() function : usage variation - Passing hexadcimal timestamp values +--FILE-- +<?php +/* Prototype : array getdate([int timestamp]) + * Description: Get date/time information + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing getdate() : usage variation ***\n"; + +//Set the default time zone +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + + //octal values + 'hexadcimal 0x5' => 0x5, + 'hexadcimal 0xCAFE' => 0xCAFE, + 'octal -0xCAFE' => -0xCAFE, +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( getdate($value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing getdate() : usage variation *** + +--hexadcimal 0x5-- +array(11) { + [u"seconds"]=> + int(5) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(5) +} + +--hexadcimal 0xCAFE-- +array(11) { + [u"seconds"]=> + int(6) + [u"minutes"]=> + int(56) + [u"hours"]=> + int(19) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(51966) +} + +--octal -0xCAFE-- +array(11) { + [u"seconds"]=> + int(54) + [u"minutes"]=> + int(3) + [u"hours"]=> + int(15) + [u"mday"]=> + int(31) + [u"wday"]=> + int(3) + [u"mon"]=> + int(12) + [u"year"]=> + int(1969) + [u"yday"]=> + int(364) + [u"weekday"]=> + unicode(9) "Wednesday" + [u"month"]=> + unicode(8) "December" + [0]=> + int(-51966) +} +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation15.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation15.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation15.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation15.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,55 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking time related formats which are not supported on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { + die("skip Test is valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + 'Time in a.m/p.m notation' => "%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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : 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=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/getdate_variation4.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/getdate_variation4.phpt diff -u /dev/null php-src/ext/date/tests/getdate_variation4.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/getdate_variation4.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,141 @@ +--TEST-- +Test getdate() function : usage variation - Verifyig by supplying year-wise sample time stamps since Unix epoch time +--FILE-- +<?php +/* Prototype : array getdate([int timestamp]) + * Description: Get date/time information + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing getdate() : usage variation ***\n"; + +//Set the default time zone +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + + //Year wise time stamps + '01 Jan 1970' => 0, + '01 Jan 1971' => 31536000, + '01 Jan 1972' => 63072000, + '01 Jan 1973' => 94694400, +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( getdate($value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing getdate() : usage variation *** + +--01 Jan 1970-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} + +--01 Jan 1971-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(5) + [u"mon"]=> + int(1) + [u"year"]=> + int(1971) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(6) "Friday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(31536000) +} + +--01 Jan 1972-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(6) + [u"mon"]=> + int(1) + [u"year"]=> + int(1972) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Saturday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(63072000) +} + +--01 Jan 1973-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(1) + [u"mon"]=> + int(1) + [u"year"]=> + int(1973) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(6) "Monday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(94694400) +} +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation14.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation14.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation14.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation14.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,60 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking date related formats which are supported other than on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { + die("skip Test is not valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + 'Century number' => "%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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Century number-- +unicode(%d) "%d" +unicode(2) "20" + +--Month Date Year-- +unicode(%d) "%d/%d/%d" +unicode(8) "08/08/08" + +--Year with century-- +unicode(%d) "%d" +unicode(4) "2008" + +--Year without century-- +unicode(%d) "%d" +unicode(2) "08" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/getdate_variation7.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/getdate_variation7.phpt diff -u /dev/null php-src/ext/date/tests/getdate_variation7.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/getdate_variation7.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,78 @@ +--TEST-- +Test getdate() function : usage variation - Passing high positive and negative float values to timestamp. +--FILE-- +<?php +/* Prototype : array getdate([int timestamp]) + * Description: Get date/time information + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing getdate() : usage variation ***\n"; +date_default_timezone_set("Asia/Calcutta"); + +echo "\n-- Testing getdate() function by passing float 12.3456789000e10 value to timestamp --\n"; +$timestamp = 12.3456789000e10; +var_dump( getdate($timestamp) ); + +echo "\n-- Testing getdate() function by passing float -12.3456789000e10 value to timestamp --\n"; +$timestamp = -12.3456789000e10; +var_dump( getdate($timestamp) ); +?> +===DONE=== +--EXPECTREGEX-- + +\*\*\* Testing getdate\(\) : usage variation \*\*\* + +-- Testing getdate\(\) function by passing float 12.3456789000e10 value to timestamp -- +array\(11\) { + \[u"seconds"\]=> + int\((7|0)\) + \[u"minutes"\]=> + int\((44|0)\) + \[u"hours"\]=> + int\((8|6)\) + \[u"mday"\]=> + int\((19|11)\) + \[u"wday"\]=> + int\((2|6)\) + \[u"mon"\]=> + int\((1|3)\) + \[u"year"\]=> + int\((2038|5882)\) + \[u"yday"\]=> + int\((18|69)\) + \[u"weekday"\]=> + unicode\((7|8)\) "(Tuesday|Saturday)" + \[u"month"\]=> + unicode\((7|5)\) "(January|March)" + \[0\]=> + int\((2147483647|123456789000)\) +} + +-- Testing getdate\(\) function by passing float -12.3456789000e10 value to timestamp -- +array\(11\) { + \[u"seconds"\]=> + int\((12|20)\) + \[u"minutes"\]=> + int\((39|23)\) + \[u"hours"\]=> + int\((2|5)\) + \[u"mday"\]=> + int\((14|23)\) + \[u"wday"\]=> + int\((6|-4)\) + \[u"mon"\]=> + int\((12|10)\) + \[u"year"\]=> + int\((1901|-1943)\) + \[u"yday"\]=> + int\((347|295)\) + \[u"weekday"\]=> + unicode\((8|7)\) "(Saturday|Unknown)" + \[u"month"\]=> + unicode\((8|7)\) "(December|October)" + \[0\]=> + int\((-2147483648|-123456789000)\) +} +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/getdate_variation2.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/getdate_variation2.phpt diff -u /dev/null php-src/ext/date/tests/getdate_variation2.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/getdate_variation2.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,114 @@ +--TEST-- +Test getdate() function : usage variation - Passing octal timestamp values +--FILE-- +<?php +/* Prototype : array getdate([int timestamp]) + * Description: Get date/time information + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing getdate() : usage variation ***\n"; + +//Set the default time zone +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + + //octal values + 'octal 05' => 05, + 'octal 010' => 010, + 'octal -010' => -010, +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( getdate($value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing getdate() : usage variation *** + +--octal 05-- +array(11) { + [u"seconds"]=> + int(5) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(5) +} + +--octal 010-- +array(11) { + [u"seconds"]=> + int(8) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(8) +} + +--octal -010-- +array(11) { + [u"seconds"]=> + int(52) + [u"minutes"]=> + int(29) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(-8) +} +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation2.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation2.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation2.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation2.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,206 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing unexpected values to second argument 'timestamp'. +--SKIPIF-- +<?php +if(PHP_INT_SIZE != 4 ) { + die("skip Test is not valid for 64-bit"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +date_default_timezone_set("Asia/Calcutta"); + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$format = '%b %d %Y %H:%M:%S'; + +//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 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 timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($format, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--float 10.5-- +unicode(20) "Jan 01 1970 00:00:10" + +--float -10.5-- +unicode(20) "Dec 31 1969 23:59:50" + +--float 12.3456789000e10-- +unicode(20) "Jan 19 2038 03:14:07" + +--float -12.3456789000e10-- +unicode(20) "Dec 13 1901 20:45:52" + +--float .5-- +unicode(20) "Jan 01 1970 00:00:00" + +--empty array-- + +Warning: gmstrftime() expects parameter 2 to be long, array given in %s on line %d +bool(false) + +--int indexed array-- + +Warning: gmstrftime() expects parameter 2 to be long, array given in %s on line %d +bool(false) + +--associative array-- + +Warning: gmstrftime() expects parameter 2 to be long, array given in %s on line %d +bool(false) + +--nested arrays-- + +Warning: gmstrftime() expects parameter 2 to be long, array given in %s on line %d +bool(false) + +--uppercase NULL-- +unicode(20) "Jan 01 1970 00:00:00" + +--lowercase null-- +unicode(20) "Jan 01 1970 00:00:00" + +--lowercase true-- +unicode(20) "Jan 01 1970 00:00:01" + +--lowercase false-- +unicode(20) "Jan 01 1970 00:00:00" + +--uppercase TRUE-- +unicode(20) "Jan 01 1970 00:00:01" + +--uppercase FALSE-- +unicode(20) "Jan 01 1970 00:00:00" + +--empty string DQ-- + +Warning: gmstrftime() expects parameter 2 to be long, Unicode string given in %s on line %d +bool(false) + +--empty string SQ-- + +Warning: gmstrftime() expects parameter 2 to be long, Unicode string given in %s on line %d +bool(false) + +--string DQ-- + +Warning: gmstrftime() expects parameter 2 to be long, Unicode string given in %s on line %d +bool(false) + +--string SQ-- + +Warning: gmstrftime() expects parameter 2 to be long, Unicode string given in %s on line %d +bool(false) + +--mixed case string-- + +Warning: gmstrftime() expects parameter 2 to be long, Unicode string given in %s on line %d +bool(false) + +--heredoc-- + +Warning: gmstrftime() expects parameter 2 to be long, Unicode string given in %s on line %d +bool(false) + +--instance of classWithToString-- + +Warning: gmstrftime() expects parameter 2 to be long, object given in %s on line %d +bool(false) + +--instance of classWithoutToString-- + +Warning: gmstrftime() expects parameter 2 to be long, object given in %s on line %d +bool(false) + +--undefined var-- +unicode(20) "Jan 01 1970 00:00:00" + +--unset var-- +unicode(20) "Jan 01 1970 00:00:00" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation9.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation9.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation9.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation9.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,50 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking week related formats which are not supported on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { + die("skip Test is valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + 'The ISO 8601:1988 week number' => "%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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--The ISO 8601:1988 week number-- +bool(false) +bool(false) + +--Weekday as decimal-- +bool(false) +bool(false) +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/getdate_variation6.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/getdate_variation6.phpt diff -u /dev/null php-src/ext/date/tests/getdate_variation6.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/getdate_variation6.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,109 @@ +--TEST-- +Test getdate() function : usage variation - Passing strings containing numbers +--FILE-- +<?php +/* Prototype : array getdate([int timestamp]) + * Description: Get date/time information + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing getdate() : usage variation ***\n"; + +date_default_timezone_set("Asia/Calcutta"); + +//Timezones with required data for date_sunrise +$inputs = array ( + 'String 0' => '0', + 'String 10.5' => "10.5", + 'String -10.5' => '-10.5', +); + +// loop through each element of the array for timestamp +foreach($inputs as $key => $value) { + echo "\n--$key--\n"; + var_dump( getdate($value) ); +}; +?> +===DONE=== +--EXPECTF-- +*** Testing getdate() : usage variation *** + +--String 0-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} + +--String 10.5-- +array(11) { + [u"seconds"]=> + int(10) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(10) +} + +--String -10.5-- +array(11) { + [u"seconds"]=> + int(50) + [u"minutes"]=> + int(29) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(-10) +} +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation18.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation18.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation18.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation18.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,37 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking day related formats which are supported other than on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { + die("skip Test is not valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +echo "\n-- Testing gmstrftime() function with Day of the month as decimal single digit format --\n"; +$format = "%e"; +var_dump( gmstrftime($format) ); +var_dump( gmstrftime($format, $timestamp) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +-- Testing gmstrftime() function with Day of the month as decimal single digit format -- +unicode(%d) "%d" +unicode(2) " 8" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation3.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation3.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation3.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation3.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,52 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing week related format strings to format argument. +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); + +//array of values to iterate over +$inputs = array( + 'Abbreviated weekday name' => "%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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Abbreviated weekday name-- +unicode(%d) "%s" +unicode(3) "Fri" + +--Full weekday name-- +unicode(%d) "%s" +unicode(6) "Friday" + +--Week number of the year-- +unicode(%d) "%d" +unicode(2) "31" + +--Week number of the year in decimal number-- +unicode(%d) "%d" +unicode(2) "31" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation20.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation20.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation20.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation20.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,52 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking newline and tab formats which are supported other than on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { + die("skip Test is not valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + 'Newline character' => "%n", + 'Tab character' => "%t" +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTREGEX-- +\*\*\* Testing gmstrftime\(\) : usage variation \*\*\* + +--Newline character-- +unicode\(1\) " +" +unicode\(1\) " +" + +--Tab character-- +unicode\(1\) "\s" +unicode\(1\) "\s" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation12.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation12.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation12.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation12.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,37 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking month related formats which are supported other than on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { + die("skip Test is not valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +echo "\n-- Testing gmstrftime() function with Abbreviated month name format %h --\n"; +$format = "%h"; +var_dump( gmstrftime($format) ); +var_dump( gmstrftime($format, $timestamp) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +-- Testing gmstrftime() function with Abbreviated month name format %h -- +unicode(%d) "%s" +unicode(3) "Aug" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation21.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation21.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation21.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation21.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,55 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking Preferred date and time representation on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { + die("skip Test is valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + 'Preferred date and time representation' => "%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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Preferred date and time representation-- +unicode(%d) "%d/%d/%d %d:%d:%d" +unicode(17) "08/08/08 08:08:08" + +--Preferred date representation-- +unicode(%d) "%d/%d/%d" +unicode(8) "08/08/08" + +--Preferred time representation-- +unicode(%d) "%d:%d:%d" +unicode(8) "08:08:08" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation7.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation7.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation7.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation7.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,49 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing day related format strings to format argument. +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + 'Day of the month as decimal number' => "%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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Day of the month as decimal number-- +unicode(%d) "%d" +unicode(2) "08" + +--Day of the year as a decimal number-- +unicode(%d) "%d" +unicode(3) "221" + +--Day of the week as a decimal number-- +unicode(%d) "%d" +unicode(1) "5" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation10.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation10.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation10.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation10.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,50 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking week related formats which are supported other than on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { + die("skip Test is not valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +//array of values to iterate over +$inputs = array( + 'The ISO 8601:1988 week number' => "%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( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--The ISO 8601:1988 week number-- +unicode(%d) "%d" +unicode(2) "32" + +--Weekday as decimal-- +unicode(%d) "%d" +unicode(1) "5" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/getdate_variation5.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/getdate_variation5.phpt diff -u /dev/null php-src/ext/date/tests/getdate_variation5.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/getdate_variation5.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,224 @@ +--TEST-- +Test getdate() function : usage variation - Verifyig with different timezones on Unix epoch timestamp +--FILE-- +<?php +/* Prototype : array getdate([int timestamp]) + * Description: Get date/time information + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing getdate() : usage variation ***\n"; + +//Timezones with required data for date_sunrise +$inputs = array ( + //GMT-11 + "Pacific/Samoa", + //GMT-9 + "US/Alaska", + //GMT-0 + "Africa/Casablanca", + //GMT+4 + "Europe/Moscow", + //GMT+8 + "Asia/Hong_Kong", + //GMT+10 + "Australia/Brisbane", + //GMT+12 + "Pacific/Wallis", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $timezone) { + echo "\n--$timezone--\n"; + date_default_timezone_set($timezone); + var_dump( getdate(0) ); +}; +?> +===DONE=== +--EXPECTF-- +*** Testing getdate() : usage variation *** + +--Pacific/Samoa-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(0) + [u"hours"]=> + int(13) + [u"mday"]=> + int(31) + [u"wday"]=> + int(3) + [u"mon"]=> + int(12) + [u"year"]=> + int(1969) + [u"yday"]=> + int(364) + [u"weekday"]=> + unicode(9) "Wednesday" + [u"month"]=> + unicode(8) "December" + [0]=> + int(0) +} + +--US/Alaska-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(0) + [u"hours"]=> + int(14) + [u"mday"]=> + int(31) + [u"wday"]=> + int(3) + [u"mon"]=> + int(12) + [u"year"]=> + int(1969) + [u"yday"]=> + int(364) + [u"weekday"]=> + unicode(9) "Wednesday" + [u"month"]=> + unicode(8) "December" + [0]=> + int(0) +} + +--Africa/Casablanca-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(0) + [u"hours"]=> + int(0) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} + +--Europe/Moscow-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(0) + [u"hours"]=> + int(3) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} + +--Asia/Hong_Kong-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(0) + [u"hours"]=> + int(8) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} + +--Australia/Brisbane-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(0) + [u"hours"]=> + int(10) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} + +--Pacific/Wallis-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(0) + [u"hours"]=> + int(12) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_error.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_error.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_error.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_error.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,38 @@ +--TEST-- +Test gmstrftime() function : error conditions +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : error conditions ***\n"; + +// Zero arguments +echo "\n-- Testing gmstrftime() function with Zero arguments --\n"; +var_dump( gmstrftime() ); + +//Test gmstrftime with one more than the expected number of arguments +echo "\n-- Testing gmstrftime() function with more than expected no. of arguments --\n"; +$format = '%b %d %Y %H:%M:%S'; +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +$extra_arg = 10; +var_dump( gmstrftime($format, $timestamp, $extra_arg) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : error conditions *** + +-- Testing gmstrftime() function with Zero arguments -- + +Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing gmstrftime() function with more than expected no. of arguments -- + +Warning: gmstrftime() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmstrftime_variation17.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/gmstrftime_variation17.phpt diff -u /dev/null php-src/ext/date/tests/gmstrftime_variation17.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/gmstrftime_variation17.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,37 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking day related formats which are not supported on Windows. +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { + die("skip Test is valid for Windows"); +} +?> +--FILE-- +<?php +/* Prototype : string gmstrftime(string format [, int timestamp]) + * Description: Format a GMT/UCT time/date according to locale settings + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing gmstrftime() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); +locale_set_default("en_US"); +date_default_timezone_set("Asia/Calcutta"); + +echo "\n-- Testing gmstrftime() function with Day of the month as decimal single digit format --\n"; +$format = "%e"; +var_dump( gmstrftime($format) ); +var_dump( gmstrftime($format, $timestamp) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +-- Testing gmstrftime() function with Day of the month as decimal single digit format -- +bool(false) +bool(false) +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/getdate_variation1.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/getdate_variation1.phpt diff -u /dev/null php-src/ext/date/tests/getdate_variation1.phpt:1.2 --- /dev/null Thu Jan 22 18:47:25 2009 +++ php-src/ext/date/tests/getdate_variation1.phpt Thu Jan 22 18:47:25 2009 @@ -0,0 +1,443 @@ +--TEST-- +Test getdate() function : usage variation - Passing unexpected values to first argument timestamp. +--FILE-- +<?php +/* Prototype : array getdate([int timestamp]) + * Description: Get date/time information + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing getdate() : usage variation ***\n"; + +//Set the default time zone +date_default_timezone_set("Asia/Calcutta"); + +//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( getdate($value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing getdate() : usage variation *** + +--float 10.5-- +array(11) { + [u"seconds"]=> + int(10) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(10) +} + +--float -10.5-- +array(11) { + [u"seconds"]=> + int(50) + [u"minutes"]=> + int(29) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(-10) +} + +--float .5-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} + +--empty array-- + +Warning: getdate() expects parameter 1 to be long, array given in %s on line %d +bool(false) + +--int indexed array-- + +Warning: getdate() expects parameter 1 to be long, array given in %s on line %d +bool(false) + +--associative array-- + +Warning: getdate() expects parameter 1 to be long, array given in %s on line %d +bool(false) + +--nested arrays-- + +Warning: getdate() expects parameter 1 to be long, array given in %s on line %d +bool(false) + +--uppercase NULL-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} + +--lowercase null-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} + +--lowercase true-- +array(11) { + [u"seconds"]=> + int(1) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(1) +} + +--lowercase false-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} + +--uppercase TRUE-- +array(11) { + [u"seconds"]=> + int(1) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(1) +} + +--uppercase FALSE-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} + +--empty string DQ-- + +Warning: getdate() expects parameter 1 to be long, Unicode string given in %s on line %d +bool(false) + +--empty string SQ-- + +Warning: getdate() expects parameter 1 to be long, Unicode string given in %s on line %d +bool(false) + +--string DQ-- + +Warning: getdate() expects parameter 1 to be long, Unicode string given in %s on line %d +bool(false) + +--string SQ-- + +Warning: getdate() expects parameter 1 to be long, Unicode string given in %s on line %d +bool(false) + +--mixed case string-- + +Warning: getdate() expects parameter 1 to be long, Unicode string given in %s on line %d +bool(false) + +--heredoc-- + +Warning: getdate() expects parameter 1 to be long, Unicode string given in %s on line %d +bool(false) + +--instance of classWithToString-- + +Warning: getdate() expects parameter 1 to be long, object given in %s on line %d +bool(false) + +--instance of classWithoutToString-- + +Warning: getdate() expects parameter 1 to be long, object given in %s on line %d +bool(false) + +--undefined var-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} + +--unset var-- +array(11) { + [u"seconds"]=> + int(0) + [u"minutes"]=> + int(30) + [u"hours"]=> + int(5) + [u"mday"]=> + int(1) + [u"wday"]=> + int(4) + [u"mon"]=> + int(1) + [u"year"]=> + int(1970) + [u"yday"]=> + int(0) + [u"weekday"]=> + unicode(8) "Thursday" + [u"month"]=> + unicode(7) "January" + [0]=> + int(0) +} +===DONE===
« previous php.cvs (#55866) next »