smantoor Fri Dec 5 06:12:11 2008 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/date/tests date_sunset_variation2.phpt
date_sunset_variation3.phpt
date_sunset_error.phpt
date_sunset_variation4.phpt
date_sunset_variation5.phpt
date_sunset_variation6.phpt
date_sunset_variation7.phpt
date_sunset_variation8.phpt
date_sunset_variation9.phpt
date_sunset_variation1.phpt
Log:
New testcases for date_sunset function
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_sunset_variation2.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/date_sunset_variation2.phpt
+++ php-src/ext/date/tests/date_sunset_variation2.phpt
--TEST--
Test date_sunset() function : usage variation - Passing unexpected values to
second argument format.
--FILE--
<?php
/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]])
* Description: Returns time of sunset for a given day and location
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing date_sunset() : usage variation ***\n";
// Initialise function arguments not being substituted (if any)
date_default_timezone_set("Asia/Calcutta");
$time = mktime(8, 8, 8, 8, 8, 2008);
$latitude = 22.34;
$longitude = 88.21;
$zenith = 90;
$gmt_offset = 5.5;
//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 format
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
var_dump( date_sunset($time, $value, $latitude, $longitude, $zenith,
$gmt_offset) );
};
?>
===DONE===
--EXPECTF--
*** Testing date_sunset() : usage variation ***
--float 10.5--
Warning: date_sunset(): Wrong return format given, pick one of
SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on
line %d
bool(false)
--float -10.5--
Warning: date_sunset(): Wrong return format given, pick one of
SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on
line %d
bool(false)
--float 12.3456789000e10--
Warning: date_sunset(): Wrong return format given, pick one of
SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on
line %d
bool(false)
--float -12.3456789000e10--
Warning: date_sunset(): Wrong return format given, pick one of
SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on
line %d
bool(false)
--float .5--
int(1218199253)
--empty array--
Warning: date_sunset() expects parameter 2 to be long, array given in %s on
line %d
bool(false)
--int indexed array--
Warning: date_sunset() expects parameter 2 to be long, array given in %s on
line %d
bool(false)
--associative array--
Warning: date_sunset() expects parameter 2 to be long, array given in %s on
line %d
bool(false)
--nested arrays--
Warning: date_sunset() expects parameter 2 to be long, array given in %s on
line %d
bool(false)
--uppercase NULL--
int(1218199253)
--lowercase null--
int(1218199253)
--lowercase true--
unicode(5) "18:10"
--lowercase false--
int(1218199253)
--uppercase TRUE--
unicode(5) "18:10"
--uppercase FALSE--
int(1218199253)
--empty string DQ--
Warning: date_sunset() expects parameter 2 to be long, Unicode string given in
%s on line %d
bool(false)
--empty string SQ--
Warning: date_sunset() expects parameter 2 to be long, Unicode string given in
%s on line %d
bool(false)
--string DQ--
Warning: date_sunset() expects parameter 2 to be long, Unicode string given in
%s on line %d
bool(false)
--string SQ--
Warning: date_sunset() expects parameter 2 to be long, Unicode string given in
%s on line %d
bool(false)
--mixed case string--
Warning: date_sunset() expects parameter 2 to be long, Unicode string given in
%s on line %d
bool(false)
--heredoc--
Warning: date_sunset() expects parameter 2 to be long, Unicode string given in
%s on line %d
bool(false)
--instance of classWithToString--
Warning: date_sunset() expects parameter 2 to be long, object given in %s on
line %d
bool(false)
--instance of classWithoutToString--
Warning: date_sunset() expects parameter 2 to be long, object given in %s on
line %d
bool(false)
--undefined var--
int(1218199253)
--unset var--
int(1218199253)
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_sunset_variation3.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/date_sunset_variation3.phpt
+++ php-src/ext/date/tests/date_sunset_variation3.phpt
--TEST--
Test date_sunset() function : usage variation - Passing unexpected values to
third argument latitude.
--FILE--
<?php
/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]])
* Description: Returns time of sunset for a given day and location
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing date_sunset() : usage variation ***\n";
// Initialise function arguments not being substituted (if any)
date_default_timezone_set("Asia/Calcutta");
$time = mktime(8, 8, 8, 8, 8, 2008);
$longitude = 88.21;
$zenith = 90;
$gmt_offset = 5.5;
//get an unset variable
$unset_var = 10;
unset ($unset_var);
// define some classes
class classWithToString
{
public function __toString() {
return "Class A object";
}
}
class classWithoutToString
{
}
// heredoc string
$heredoc = <<<EOT
hello world
EOT;
// add arrays
$index_array = array (1, 2, 3);
$assoc_array = array ('one' => 1, 'two' => 2);
//array of values to iterate over
$inputs = array(
// int data
'int 0' => 0,
'int 1' => 1,
'int 12345' => 12345,
'int -12345' => -2345,
// 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 latitude
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value, $longitude,
$zenith, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $value, $longitude,
$zenith, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $value, $longitude,
$zenith, $gmt_offset) );
};
?>
===DONE===
--EXPECTF--
*** Testing date_sunset() : usage variation ***
--int 0--
unicode(5) "17:43"
float(17.730%d)
int(1218197630)
--int 1--
unicode(5) "17:44"
float(17.749%d)
int(1218197698)
--int 12345--
bool(false)
bool(false)
bool(false)
--int -12345--
unicode(5) "17:35"
float(17.598%d)
int(1218197155)
--empty array--
Warning: date_sunset() expects parameter 3 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, array given in %s on
line %d
bool(false)
--int indexed array--
Warning: date_sunset() expects parameter 3 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, array given in %s on
line %d
bool(false)
--associative array--
Warning: date_sunset() expects parameter 3 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, array given in %s on
line %d
bool(false)
--nested arrays--
Warning: date_sunset() expects parameter 3 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, array given in %s on
line %d
bool(false)
--uppercase NULL--
unicode(5) "17:43"
float(17.730%d)
int(1218197630)
--lowercase null--
unicode(5) "17:43"
float(17.730%d)
int(1218197630)
--lowercase true--
unicode(5) "17:44"
float(17.749%d)
int(1218197698)
--lowercase false--
unicode(5) "17:43"
float(17.730%d)
int(1218197630)
--uppercase TRUE--
unicode(5) "17:44"
float(17.749%d)
int(1218197698)
--uppercase FALSE--
unicode(5) "17:43"
float(17.730%d)
int(1218197630)
--empty string DQ--
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
--empty string SQ--
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
--string DQ--
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
--string SQ--
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
--mixed case string--
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
--heredoc--
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, Unicode string given
in %s on line %d
bool(false)
--instance of classWithToString--
Warning: date_sunset() expects parameter 3 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, object given in %s on
line %d
bool(false)
--instance of classWithoutToString--
Warning: date_sunset() expects parameter 3 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 3 to be double, object given in %s on
line %d
bool(false)
--undefined var--
unicode(5) "17:43"
float(17.730%d)
int(1218197630)
--unset var--
unicode(5) "17:43"
float(17.730%d)
int(1218197630)
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_sunset_error.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/date_sunset_error.phpt
+++ php-src/ext/date/tests/date_sunset_error.phpt
--TEST--
Test date_sunset() function : error conditions
--FILE--
<?php
/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]])
* Description: Returns time of sunset for a given day and location
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing date_sunset() : error conditions ***\n";
//Initialise the variables
$time = time();
$latitude = 38.4;
$longitude = -9;
$zenith = 90;
$gmt_offset = 1;
$extra_arg = 10;
// Zero arguments
echo "\n-- Testing date_sunset() function with Zero arguments --\n";
var_dump( date_sunset() );
//Test date_sunset with one more than the expected number of arguments
echo "\n-- Testing date_sunset() function with more than expected no. of
arguments --\n";
var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude,
$zenith, $gmt_offset, $extra_arg) );
var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude,
$zenith, $gmt_offset, $extra_arg) );
var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude,
$zenith, $gmt_offset, $extra_arg) );
?>
===DONE===
--EXPECTF--
*** Testing date_sunset() : error conditions ***
-- Testing date_sunset() function with Zero arguments --
Warning: date_sunset() expects at least 1 parameter, 0 given in %s on line %d
bool(false)
-- Testing date_sunset() function with more than expected no. of arguments --
Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d
bool(false)
Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d
bool(false)
Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d
bool(false)
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_sunset_variation4.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/date_sunset_variation4.phpt
+++ php-src/ext/date/tests/date_sunset_variation4.phpt
--TEST--
Test date_sunset() function : usage variation - Passing unexpected values to
fourth argument longitude.
--FILE--
<?php
/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]])
* Description: Returns time of sunset for a given day and location
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing date_sunset() : usage variation ***\n";
// Initialise function arguments not being substituted (if any)
date_default_timezone_set("Asia/Calcutta");
$time = mktime(8, 8, 8, 8, 8, 2008);
$latitude = 22.34;
$zenith = 90;
$gmt_offset = 5.5;
//get an unset variable
$unset_var = 10;
unset ($unset_var);
// define some classes
class classWithToString
{
public function __toString() {
return "Class A object";
}
}
class classWithoutToString
{
}
// heredoc string
$heredoc = <<<EOT
hello world
EOT;
// add arrays
$index_array = array (1, 2, 3);
$assoc_array = array ('one' => 1, 'two' => 2);
//array of values to iterate over
$inputs = array(
// int data
'int 0' => 0,
'int 1' => 1,
'int 12345' => 12345,
'int -12345' => -2345,
// 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 longitude
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $value,
$zenith, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $value,
$zenith, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $value,
$zenith, $gmt_offset) );
};
?>
===DONE===
--EXPECTF--
*** Testing date_sunset() : usage variation ***
--int 0--
unicode(5) "00:03"
float(0.059%d)
int(1218220414)
--int 1--
unicode(5) "23:59"
float(23.992%d)
int(1218220174)
--int 12345--
unicode(5) "17:15"
float(17.259%d)
int(1218195932)
--int -12345--
unicode(5) "12:18"
float(12.316%d)
int(1218178138)
--empty array--
Warning: date_sunset() expects parameter 4 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, array given in %s on
line %d
bool(false)
--int indexed array--
Warning: date_sunset() expects parameter 4 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, array given in %s on
line %d
bool(false)
--associative array--
Warning: date_sunset() expects parameter 4 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, array given in %s on
line %d
bool(false)
--nested arrays--
Warning: date_sunset() expects parameter 4 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, array given in %s on
line %d
bool(false)
--uppercase NULL--
unicode(5) "00:03"
float(0.059%d)
int(1218220414)
--lowercase null--
unicode(5) "00:03"
float(0.059%d)
int(1218220414)
--lowercase true--
unicode(5) "23:59"
float(23.992%d)
int(1218220174)
--lowercase false--
unicode(5) "00:03"
float(0.059%d)
int(1218220414)
--uppercase TRUE--
unicode(5) "23:59"
float(23.992%d)
int(1218220174)
--uppercase FALSE--
unicode(5) "00:03"
float(0.059%d)
int(1218220414)
--empty string DQ--
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
--empty string SQ--
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
--string DQ--
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
--string SQ--
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
--mixed case string--
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
--heredoc--
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, Unicode string given
in %s on line %d
bool(false)
--instance of classWithToString--
Warning: date_sunset() expects parameter 4 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, object given in %s on
line %d
bool(false)
--instance of classWithoutToString--
Warning: date_sunset() expects parameter 4 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 4 to be double, object given in %s on
line %d
bool(false)
--undefined var--
unicode(5) "00:03"
float(0.059%d)
int(1218220414)
--unset var--
unicode(5) "00:03"
float(0.059%d)
int(1218220414)
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_sunset_variation5.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/date_sunset_variation5.phpt
+++ php-src/ext/date/tests/date_sunset_variation5.phpt
--TEST--
Test date_sunset() function : usage variation - Passing unexpected values to
fifth argument zenith.
--FILE--
<?php
/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]])
* Description: Returns time of sunset for a given day and location
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing date_sunset() : usage variation ***\n";
// Initialise function arguments not being substituted (if any)
date_default_timezone_set("Asia/Calcutta");
$time = mktime(8, 8, 8, 8, 8, 2008);
$longitude = 88.21;
$latitude = 22.34;
$gmt_offset = 5.5;
//get an unset variable
$unset_var = 10;
unset ($unset_var);
// define some classes
class classWithToString
{
public function __toString() {
return "Class A object";
}
}
class classWithoutToString
{
}
// heredoc string
$heredoc = <<<EOT
hello world
EOT;
// add arrays
$index_array = array (1, 2, 3);
$assoc_array = array ('one' => 1, 'two' => 2);
//array of values to iterate over
$inputs = array(
// int data
'int 0' => 0,
'int 1' => 1,
'int 12345' => 12345,
'int -12345' => -2345,
// 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 zenith
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude,
$value, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude,
$value, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude,
$longitude, $value, $gmt_offset) );
};
?>
===DONE===
--EXPECTF--
*** Testing date_sunset() : usage variation ***
--int 0--
bool(false)
bool(false)
bool(false)
--int 1--
bool(false)
bool(false)
bool(false)
--int 12345--
unicode(5) "19:19"
float(19.319%d)
int(1218203349)
--int -12345--
bool(false)
bool(false)
bool(false)
--empty array--
Warning: date_sunset() expects parameter 5 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, array given in %s on
line %d
bool(false)
--int indexed array--
Warning: date_sunset() expects parameter 5 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, array given in %s on
line %d
bool(false)
--associative array--
Warning: date_sunset() expects parameter 5 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, array given in %s on
line %d
bool(false)
--nested arrays--
Warning: date_sunset() expects parameter 5 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, array given in %s on
line %d
bool(false)
--uppercase NULL--
bool(false)
bool(false)
bool(false)
--lowercase null--
bool(false)
bool(false)
bool(false)
--lowercase true--
bool(false)
bool(false)
bool(false)
--lowercase false--
bool(false)
bool(false)
bool(false)
--uppercase TRUE--
bool(false)
bool(false)
bool(false)
--uppercase FALSE--
bool(false)
bool(false)
bool(false)
--empty string DQ--
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
--empty string SQ--
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
--string DQ--
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
--string SQ--
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
--mixed case string--
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
--heredoc--
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, Unicode string given
in %s on line %d
bool(false)
--instance of classWithToString--
Warning: date_sunset() expects parameter 5 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, object given in %s on
line %d
bool(false)
--instance of classWithoutToString--
Warning: date_sunset() expects parameter 5 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 5 to be double, object given in %s on
line %d
bool(false)
--undefined var--
bool(false)
bool(false)
bool(false)
--unset var--
bool(false)
bool(false)
bool(false)
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_sunset_variation6.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/date_sunset_variation6.phpt
+++ php-src/ext/date/tests/date_sunset_variation6.phpt
--TEST--
Test date_sunset() function : usage variation - Passing unexpected values to
sixth argument gmt_offset.
--FILE--
<?php
/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]])
* Description: Returns time of sunset for a given day and location
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing date_sunset() : usage variation ***\n";
// Initialise function arguments not being substituted (if any)
date_default_timezone_set("Asia/Calcutta");
$time = mktime(8, 8, 8, 8, 8, 2008);
$longitude = 88.21;
$latitude = 22.34;
$zenith = 90;
//get an unset variable
$unset_var = 10;
unset ($unset_var);
// define some classes
class classWithToString
{
public function __toString() {
return "Class A object";
}
}
class classWithoutToString
{
}
// heredoc string
$heredoc = <<<EOT
hello world
EOT;
// add arrays
$index_array = array (1, 2, 3);
$assoc_array = array ('one' => 1, 'two' => 2);
//array of values to iterate over
$inputs = array(
// int data
'int 0' => 0,
'int 1' => 1,
'int 12345' => 12345,
'int -12345' => -2345,
// 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 gmt_offset
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude,
$zenith, $value) );
var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude,
$zenith, $value) );
var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude,
$longitude, $zenith, $value) );
};
?>
===DONE===
--EXPECTF--
*** Testing date_sunset() : usage variation ***
--int 0--
unicode(5) "12:40"
float(12.681%d)
int(1218199253)
--int 1--
unicode(5) "13:40"
float(13.681%d)
int(1218199253)
--int 12345--
unicode(5) "21:40"
float(21.681%d)
int(1218199253)
--int -12345--
unicode(5) "19:40"
float(19.681%d)
int(1218199253)
--empty array--
Warning: date_sunset() expects parameter 6 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, array given in %s on
line %d
bool(false)
--int indexed array--
Warning: date_sunset() expects parameter 6 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, array given in %s on
line %d
bool(false)
--associative array--
Warning: date_sunset() expects parameter 6 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, array given in %s on
line %d
bool(false)
--nested arrays--
Warning: date_sunset() expects parameter 6 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, array given in %s on
line %d
bool(false)
--uppercase NULL--
unicode(5) "12:40"
float(12.681%d)
int(1218199253)
--lowercase null--
unicode(5) "12:40"
float(12.681%d)
int(1218199253)
--lowercase true--
unicode(5) "13:40"
float(13.681%d)
int(1218199253)
--lowercase false--
unicode(5) "12:40"
float(12.681%d)
int(1218199253)
--uppercase TRUE--
unicode(5) "13:40"
float(13.681%d)
int(1218199253)
--uppercase FALSE--
unicode(5) "12:40"
float(12.681%d)
int(1218199253)
--empty string DQ--
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
--empty string SQ--
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
--string DQ--
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
--string SQ--
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
--mixed case string--
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
--heredoc--
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, Unicode string given
in %s on line %d
bool(false)
--instance of classWithToString--
Warning: date_sunset() expects parameter 6 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, object given in %s on
line %d
bool(false)
--instance of classWithoutToString--
Warning: date_sunset() expects parameter 6 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 6 to be double, object given in %s on
line %d
bool(false)
--undefined var--
unicode(5) "12:40"
float(12.681%d)
int(1218199253)
--unset var--
unicode(5) "12:40"
float(12.681%d)
int(1218199253)
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_sunset_variation7.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/date_sunset_variation7.phpt
+++ php-src/ext/date/tests/date_sunset_variation7.phpt
--TEST--
Test date_sunset() function : usage variation - Checking sunrise for
consecutive days in specific timezone
--FILE--
<?php
/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]])
* Description: Returns time of sunrise for a given day and location
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing date_sunset() : usage variation ***\n";
//Timezones with required data for date_sunrise
$inputs = array (
//Timezone with Latitude, Longitude and GMT offset
"Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" =>
-170.72, "GMT" => -11),
"US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 ,
"GMT" => -9),
"America/Chicago" => array ("Latitude" => 41.85, "Longitude" =>
-87.65 , "GMT" => -5),
"America/Montevideo" => array ("Latitude" => -34.88,
"Longitude" => -56.18 , "GMT" => -3),
"Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude"
=> "-7.58", "GMT" => 0),
"Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" =>
37.58, "GMT" => 4),
"Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" =>
114.15 , "GMT" => 8),
"Australia/Brisbane" => array ("Latitude" => -27.46,
"Longitude" => 153.2 , "GMT" => 10),
"Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" =>
-176.16, "GMT" => 12),
);
foreach($inputs as $timezone => $value) {
echo "\n--$timezone--\n";
date_default_timezone_set($timezone);
$time = mktime(8, 8, 8, 8, 11, 2008);
var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"],
$value["Longitude"], 90, $value["GMT"] ));
$time = mktime(8, 8, 8, 8, 12, 2008);
var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"],
$value["Longitude"], 90, $value["GMT"]) );
}
?>
===DONE===
--EXPECTF--
*** Testing date_sunset() : usage variation ***
--Pacific/Samoa--
unicode(5) "18:13"
unicode(5) "18:13"
--US/Alaska--
unicode(5) "21:00"
unicode(5) "20:57"
--America/Chicago--
unicode(5) "19:51"
unicode(5) "19:50"
--America/Montevideo--
unicode(5) "18:08"
unicode(5) "18:09"
--Africa/Casablanca--
unicode(5) "19:17"
unicode(5) "19:16"
--Europe/Moscow--
unicode(5) "21:09"
unicode(5) "21:07"
--Asia/Hong_Kong--
unicode(5) "18:55"
unicode(5) "18:54"
--Australia/Brisbane--
unicode(5) "17:21"
unicode(5) "17:21"
--Pacific/Wallis--
unicode(5) "17:36"
unicode(5) "17:36"
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_sunset_variation8.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/date_sunset_variation8.phpt
+++ php-src/ext/date/tests/date_sunset_variation8.phpt
--TEST--
Test date_sunset() function : usage variation - Checking with North and South
poles when Sun is up and down all day
--FILE--
<?php
/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]])
* Description: Returns time of sunrise for a given day and location
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing date_sunset() : usage variation ***\n";
// GMT is zero for the timezone
date_default_timezone_set("Africa/Casablanca");
$time_date = array (
//Date at which Sun is up all day at North Pole
"12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008),
"13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008),
//Date at which Sun is up all day at South Pole
"12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008),
"13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008),
);
//Iterate over different date and time
foreach( $time_date as $date => $time ){
echo "\n--$date--\n";
var_dump( date_sunset($time, SUNFUNCS_RET_STRING, 90, 0 ) );
var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) );
var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) );
var_dump( date_sunset($time, SUNFUNCS_RET_STRING, -90, 0 ) );
var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) );
var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) );
}
?>
===DONE===
--EXPECTF--
*** Testing date_sunset() : usage variation ***
--12 Aug 2008--
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
--13 Aug 2008--
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
--12 Nov 2008--
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
--13 Nov 2008--
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_sunset_variation9.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/date_sunset_variation9.phpt
+++ php-src/ext/date/tests/date_sunset_variation9.phpt
--TEST--
Test date_sunset() function : usage variation - Passing high positive and
negative float values to time argument.
--FILE--
<?php
/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]])
* Description: Returns time of sunset for a given day and location
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing date_sunset() : usage variation ***\n";
// GMT is zero for the timezone
date_default_timezone_set("Asia/Calcutta");
//Initialise the variables
$latitude = 38.4;
$longitude = -9;
$zenith = 90;
$gmt_offset = 1;
echo "\n-- Testing date_sunset() function by passing float 12.3456789000e10
value to time --\n";
$time = 12.3456789000e10;
var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude,
$zenith, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude,
$zenith, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude,
$zenith, $gmt_offset) );
echo "\n-- Testing date_sunset() function by passing float -12.3456789000e10
value to time --\n";
$time = -12.3456789000e10;
var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude,
$zenith, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude,
$zenith, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude,
$zenith, $gmt_offset) );
?>
===DONE===
--EXPECTREGEX--
\*\*\* Testing date_sunset\(\) : usage variation \*\*\*
-- Testing date_sunset\(\) function by passing float 12.3456789000e10 value to
time --
unicode\(5\) "(18:40|19:28)"
float\((18.676[0-9]*|18.6762[0-9]*|19.480[0-9]*)\)
int\((-2147431662|123456853728)\)
-- Testing date_sunset\(\) function by passing float -12.3456789000e10 value to
time --
unicode\(5\) "(18:12|18:48)"
float\((18.213[0-9]*|18.808[0-9]*)\)
int\((-2147410031|-123456723090)\)
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_sunset_variation1.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/date_sunset_variation1.phpt
+++ php-src/ext/date/tests/date_sunset_variation1.phpt
--TEST--
Test date_sunset() function : usage variation - Passing unexpected values to
first argument time.
--FILE--
<?php
/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]])
* Description: Returns time of sunset for a given day and location
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing date_sunset() : usage variation ***\n";
//Initialise the variables
$latitude = 38.4;
$longitude = -9;
$zenith = 90;
$gmt_offset = 1;
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(
// int data
'int 0' => 0,
'int 1' => 1,
'int 12345' => 12345,
'int -12345' => -2345,
// float data
'float 10.5' => 10.5,
'float -10.5' => -10.5,
'float .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 time
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
var_dump( date_sunset($value, SUNFUNCS_RET_STRING, $latitude, $longitude,
$zenith, $gmt_offset) );
var_dump( date_sunset($value, SUNFUNCS_RET_DOUBLE, $latitude, $longitude,
$zenith, $gmt_offset) );
var_dump( date_sunset($value, SUNFUNCS_RET_TIMESTAMP, $latitude,
$longitude, $zenith, $gmt_offset) );
};
?>
===DONE===
--EXPECTF--
*** Testing date_sunset() : usage variation ***
--int 0--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--int 1--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--int 12345--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--int -12345--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--float 10.5--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--float -10.5--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--float .5--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--empty array--
Warning: date_sunset() expects parameter 1 to be long, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, array given in %s on
line %d
bool(false)
--int indexed array--
Warning: date_sunset() expects parameter 1 to be long, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, array given in %s on
line %d
bool(false)
--associative array--
Warning: date_sunset() expects parameter 1 to be long, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, array given in %s on
line %d
bool(false)
--nested arrays--
Warning: date_sunset() expects parameter 1 to be long, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, array given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, array given in %s on
line %d
bool(false)
--uppercase NULL--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--lowercase null--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--lowercase true--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--lowercase false--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--uppercase TRUE--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--uppercase FALSE--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--empty string DQ--
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
--empty string SQ--
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
--string DQ--
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
--string SQ--
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
--mixed case string--
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
--heredoc--
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, Unicode string given in
%s on line %d
bool(false)
--instance of classWithToString--
Warning: date_sunset() expects parameter 1 to be long, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, object given in %s on
line %d
bool(false)
--instance of classWithoutToString--
Warning: date_sunset() expects parameter 1 to be long, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, object given in %s on
line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be long, object given in %s on
line %d
bool(false)
--undefined var--
unicode(5) "18:22"
float(18.377%d)
int(62558)
--unset var--
unicode(5) "18:22"
float(18.377%d)
int(62558)
===DONE===
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php