smantoor                Mon Dec 15 10:36:54 2008 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/date/tests     gmdate_variation7.phpt 
                                gmdate_variation10.phpt 
                                gmdate_variation8.phpt 
                                gmdate_variation11.phpt 
                                gmdate_variation9.phpt 
                                gmdate_variation12.phpt 
                                gmdate_variation13.phpt 
                                gmdate_variation14.phpt gmdate_error.phpt 
                                gmdate_variation1.phpt 
                                gmdate_variation2.phpt gmdate_basic.phpt 
                                gmdate_variation3.phpt 
                                gmdate_variation4.phpt 
                                gmdate_variation5.phpt 
                                gmdate_variation6.phpt 
  Log:
  New testcases for gmdate function
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation7.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation7.phpt
+++ php-src/ext/date/tests/gmdate_variation7.phpt
--TEST--
Test gmdate() function : usage variation - Passing Year format options to 
format argument.
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : usage variation ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');
$timestamp = mktime(8, 8, 8, 8, 8, 2008);
$timestamp_non_leap_year = mktime(8, 8, 8, 8, 8, 2007);

echo "\n-- Testing gmdate() function with checking non leap year using Leap 
Year format --\n";
var_dump( gmdate('L', $timestamp_non_leap_year) );

echo "\n-- Testing gmdate() function with checking leap year using Leap Year 
format --\n";
var_dump( gmdate('L') );
var_dump( gmdate('L', $timestamp) );

echo "\n-- Testing gmdate() function with ISO-8601 year number format --\n";
var_dump( gmdate('o') );
var_dump( gmdate('o', $timestamp) );

echo "\n-- Testing gmdate() function with full numeric representation of year 
format --\n";
var_dump( gmdate('Y') );
var_dump( gmdate('Y', $timestamp) );

echo "\n-- Testing gmdate() function with 2 digit representation year format 
--\n";
var_dump( gmdate('y') );
var_dump( gmdate('y', $timestamp) );

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***

-- Testing gmdate() function with checking non leap year using Leap Year format 
--
unicode(1) "0"

-- Testing gmdate() function with checking leap year using Leap Year format --
unicode(1) "%d"
unicode(1) "1"

-- Testing gmdate() function with ISO-8601 year number format --
unicode(4) "%d"
unicode(4) "2008"

-- Testing gmdate() function with full numeric representation of year format --
unicode(4) "%d"
unicode(4) "2008"

-- Testing gmdate() function with 2 digit representation year format --
unicode(2) "%d"
unicode(2) "08"
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation10.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation10.phpt
+++ php-src/ext/date/tests/gmdate_variation10.phpt
--TEST--
Test gmdate() function : usage variation - Passing Timezone format options to 
format argument.
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : usage variation ***\n";

// Initialise all required variables
date_default_timezone_set('Asia/Calcutta');
$timestamp = mktime(8, 8, 8, 8, 8, 2008);

echo "\n-- Testing gmdate() function with Timezone identifier format --\n";
var_dump( gmdate('e') );
var_dump( gmdate('e', $timestamp) );

echo "\n-- Testing gmdate() function with checking whether date is in daylight 
saving time format --\n";
var_dump( gmdate('I') );
var_dump( gmdate('I', $timestamp) );

echo "\n-- Testing gmdate() function with difference to GMT in hours format 
--\n";
var_dump( gmdate('O') );
var_dump( gmdate('O', $timestamp) );

echo "\n-- Testing gmdate() function with Difference to GMT in hours using 
colon as separator format --\n";
var_dump( gmdate('P') );
var_dump( gmdate('P', $timestamp) );

echo "\n-- Testing gmdate() function with timezone abbreviation format --\n";
var_dump( gmdate('T') );
var_dump( gmdate('T', $timestamp) );

echo "\n-- Testing gmdate() function with timezone offset format --\n";
var_dump( gmdate('T') );
var_dump( gmdate('T', $timestamp) );

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***

-- Testing gmdate() function with Timezone identifier format --
unicode(3) "UTC"
unicode(3) "UTC"

-- Testing gmdate() function with checking whether date is in daylight saving 
time format --
unicode(1) "%d"
unicode(1) "%d"

-- Testing gmdate() function with difference to GMT in hours format --
unicode(5) "+0000"
unicode(5) "+0000"

-- Testing gmdate() function with Difference to GMT in hours using colon as 
separator format --
unicode(6) "+00:00"
unicode(6) "+00:00"

-- Testing gmdate() function with timezone abbreviation format --
unicode(3) "GMT"
unicode(3) "GMT"

-- Testing gmdate() function with timezone offset format --
unicode(3) "GMT"
unicode(3) "GMT"
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation8.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation8.phpt
+++ php-src/ext/date/tests/gmdate_variation8.phpt
--TEST--
Test gmdate() function : usage variation - Passing Year format options to 
format argument.
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : usage variation ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');
$timestamp = mktime(8, 8, 8, 8, 8, 2008);
$timestamp_non_leap_year = mktime(8, 8, 8, 8, 8, 2007);

echo "\n-- Testing gmdate() function with checking non leap year using Leap 
Year format --\n";
var_dump( gmdate('L', $timestamp_non_leap_year) );

echo "\n-- Testing gmdate() function with checking leap year using Leap Year 
format --\n";
var_dump( gmdate('L') );
var_dump( gmdate('L', $timestamp) );

echo "\n-- Testing gmdate() function with ISO-8601 year number format --\n";
var_dump( gmdate('o') );
var_dump( gmdate('o', $timestamp) );

echo "\n-- Testing gmdate() function with full numeric representation of year 
format --\n";
var_dump( gmdate('Y') );
var_dump( gmdate('Y', $timestamp) );

echo "\n-- Testing gmdate() function with 2 digit representation year format 
--\n";
var_dump( gmdate('y') );
var_dump( gmdate('y', $timestamp) );

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***

-- Testing gmdate() function with checking non leap year using Leap Year format 
--
unicode(1) "0"

-- Testing gmdate() function with checking leap year using Leap Year format --
unicode(1) "%d"
unicode(1) "1"

-- Testing gmdate() function with ISO-8601 year number format --
unicode(4) "%d"
unicode(4) "2008"

-- Testing gmdate() function with full numeric representation of year format --
unicode(4) "%d"
unicode(4) "2008"

-- Testing gmdate() function with 2 digit representation year format --
unicode(2) "%d"
unicode(2) "08"
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation11.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation11.phpt
+++ php-src/ext/date/tests/gmdate_variation11.phpt
--TEST--
Test gmdate() function : usage variation - Passing Full Date/Time format 
options to format argument.
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : usage variation ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');
$timestamp = mktime(8, 8, 8, 8, 8, 2008);

echo "\n-- Testing gmdate() function with ISO 8601 date format --\n";
var_dump( gmdate('c') );
var_dump( gmdate('c', $timestamp) );

echo "\n-- Testing gmdate() function with RFC 2822 date format --\n";
var_dump( gmdate('r') );
var_dump( gmdate('r', $timestamp) );

echo "\n-- Testing gmdate() function with seconds since Unix Epoch format --\n";
var_dump( gmdate('U') );
var_dump( gmdate('U', $timestamp) );

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***

-- Testing gmdate() function with ISO 8601 date format --
unicode(%d) "%s"
unicode(25) "2008-08-08T08:08:08+00:00"

-- Testing gmdate() function with RFC 2822 date format --
unicode(%d) "%s"
unicode(31) "Fri, 08 Aug 2008 08:08:08 +0000"

-- Testing gmdate() function with seconds since Unix Epoch format --
unicode(%d) "%d"
unicode(10) "1218182888"
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation9.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation9.phpt
+++ php-src/ext/date/tests/gmdate_variation9.phpt
--TEST--
Test gmdate() function : usage variation - Passing Time format options to 
format argument.
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : usage variation ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');
$timestamp = mktime(8, 8, 8, 8, 8, 2008);

$time_formats = array(

      'Lowercase Ante meridiem and post meridiem' => 'a',
          'Uppercase Ante meridiem and post meridiem' => 'a',
          'Swatch Internet time' => 'B',
          '12-hour format without leading zeros' => 'g',
          '24-hour format without leading zeros' => 'G',
          '12-hour format with leading zeros' => 'h',
          '24-hour format with leading zeros' => 'H',
          'Minutes with leading zeros' => 'i',
          'Seconds with leading zeros' => 's',
          'Milliseconds' => 'u',
);

foreach($time_formats as $key =>$value) {
      echo "\n--$key--\n";
          var_dump( gmdate($value) );
          var_dump( gmdate($value, $timestamp) );
}         

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***

--Lowercase Ante meridiem and post meridiem--
unicode(2) "%s"
unicode(2) "am"

--Uppercase Ante meridiem and post meridiem--
unicode(2) "%s"
unicode(2) "am"

--Swatch Internet time--
unicode(3) "%d"
unicode(3) "380"

--12-hour format without leading zeros--
unicode(%d) "%d"
unicode(1) "8"

--24-hour format without leading zeros--
unicode(%d) "%d"
unicode(1) "8"

--12-hour format with leading zeros--
unicode(2) "%d"
unicode(2) "08"

--24-hour format with leading zeros--
unicode(2) "%d"
unicode(2) "08"

--Minutes with leading zeros--
unicode(2) "%d"
unicode(2) "08"

--Seconds with leading zeros--
unicode(2) "%d"
unicode(2) "08"

--Milliseconds--
unicode(6) "%d"
unicode(6) "000000"
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation12.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation12.phpt
+++ php-src/ext/date/tests/gmdate_variation12.phpt
--TEST--
Test gmdate() function : usage variation - Valid and invalid range of timestamp.
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : usage variation ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');

$timestamp = mktime(20, 45, 54, 12, 13, 1901);
echo "\n-- Testing gmdate() function with minimum range of timestamp --\n";
var_dump( gmdate(DATE_ISO8601, $timestamp) );

$timestamp = mktime(20, 45, 50, 12, 13, 1901);
echo "\n-- Testing gmdate() function with less than the range of timestamp 
--\n";
var_dump( gmdate(DATE_ISO8601, $timestamp) );

echo "\n-- Testing gmdate() function with maximum range of timestamp --\n";
$timestamp = mktime(03, 14, 07, 1, 19, 2038);
var_dump( gmdate(DATE_ISO8601, $timestamp) );

echo "\n-- Testing gmdate() function with greater than the range of timestamp 
--\n";
$timestamp = mktime(03, 14, 10, 1, 19, 2038);
var_dump( gmdate(DATE_ISO8601, $timestamp) );

?>
===DONE===
--EXPECTREGEX--
\*\*\* Testing gmdate\(\) : usage variation \*\*\*

-- Testing gmdate\(\) function with minimum range of timestamp --
unicode\(24\) "1901-12-13T20:45:54\+0000"

-- Testing gmdate\(\) function with less than the range of timestamp --
unicode\(24\) "(1970-01-01T00:00:00\+0000|1901-12-13T20:45:50\+0000)"

-- Testing gmdate\(\) function with maximum range of timestamp --
unicode\(24\) "2038-01-19T03:14:07\+0000"

-- Testing gmdate\(\) function with greater than the range of timestamp --
unicode\(24\) "(1970-01-01T00:00:00\+0000|2038-01-19T03:14:10\+0000)"
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation13.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation13.phpt
+++ php-src/ext/date/tests/gmdate_variation13.phpt
--TEST--
Test gmdate() function : usage variation - Passing predefined constants to 
format argument.
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 */

echo "*** Testing gmdate() : usage variation ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');
$timestamp = mktime(8, 8, 8, 8, 8, 2008);

//array of values to iterate over
$inputs = array(
      // Predefined Date constants
      'DATE_ATOM Constant' => DATE_ATOM,
          'DATE_COOKIE Constant' => DATE_COOKIE,
          'DATE_RFC822 Constant' => DATE_RFC822,
          'DATE_RFC850 Constant' => DATE_RFC850,
          'DATE_RFC1036 Constant' => DATE_RFC1036,
          'DATE_RFC1123 Constant' => DATE_RFC1123,
          'DATE_RFC2822 Constant' => DATE_RFC2822,
          'DATE_RFC3339 Constant' => DATE_RFC3339,
          'DATE_RSS Constant' => DATE_RSS,
          'DATE_W3C Constant' => DATE_W3C,
);

// loop through each element of the array for format
foreach($inputs as $key =>$value) {
      echo "\n--$key--\n";
          var_dump( gmdate($value, $timestamp) );
          var_dump( gmdate($value) );
};

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***

--DATE_ATOM Constant--
unicode(25) "2008-08-08T08:08:08+00:00"
unicode(%d) "%s"

--DATE_COOKIE Constant--
unicode(30) "Friday, 08-Aug-08 08:08:08 GMT"
unicode(%d) "%s"

--DATE_RFC822 Constant--
unicode(29) "Fri, 08 Aug 08 08:08:08 +0000"
unicode(%d) "%s"

--DATE_RFC850 Constant--
unicode(30) "Friday, 08-Aug-08 08:08:08 GMT"
unicode(%d) "%s"

--DATE_RFC1036 Constant--
unicode(29) "Fri, 08 Aug 08 08:08:08 +0000"
unicode(%d) "%s"

--DATE_RFC1123 Constant--
unicode(31) "Fri, 08 Aug 2008 08:08:08 +0000"
unicode(%d) "%s"

--DATE_RFC2822 Constant--
unicode(31) "Fri, 08 Aug 2008 08:08:08 +0000"
unicode(%d) "%s"

--DATE_RFC3339 Constant--
unicode(25) "2008-08-08T08:08:08+00:00"
unicode(%d) "%s"

--DATE_RSS Constant--
unicode(31) "Fri, 08 Aug 2008 08:08:08 +0000"
unicode(%d) "%s"

--DATE_W3C Constant--
unicode(25) "2008-08-08T08:08:08+00:00"
unicode(%d) "%s"
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation14.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation14.phpt
+++ php-src/ext/date/tests/gmdate_variation14.phpt
--TEST--
Test gmdate() function : usage variation - Passing high positive and negetive 
float values to timestamp.
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 */

echo "*** Testing gmdate() : usage variation ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');
$format = DATE_ISO8601;

echo "\n-- Testing gmdate() function with float 12.3456789000e10 to timestamp 
--\n";
$timestamp = 12.3456789000e10;
var_dump( gmdate($format, $timestamp) );

echo "\n-- Testing gmdate() function with float -12.3456789000e10 to timestamp 
--\n";
$timestamp = -12.3456789000e10;
var_dump( gmdate($format, $timestamp) );

?>
===DONE===
--EXPECTREGEX--
\*\*\* Testing gmdate\(\) : usage variation \*\*\*

-- Testing gmdate\(\) function with float 12.3456789000e10 to timestamp --
unicode\((24|25)\) "(2038-01-19T03:14:07\+0000|5882-03-11T00:30:00\+0000)"

-- Testing gmdate\(\) function with float -12.3456789000e10 to timestamp --
unicode\((24|25)\) "(1901-12-13T20:45:52\+0000|-1943-10-22T23:30:00\+0000)"
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_error.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_error.phpt
+++ php-src/ext/date/tests/gmdate_error.phpt
--TEST--
Test gmdate() function : error conditions 
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : error conditions ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');
$format = DATE_ISO8601;
$timestamp = mktime(8, 8, 8, 8, 8, 2008);

// Zero arguments
echo "\n-- Testing gmdate() function with Zero arguments --\n";
var_dump( gmdate() );

//Test gmdate with one more than the expected number of arguments
echo "\n-- Testing gmdate() function with more than expected no. of arguments 
--\n";
$extra_arg = 10;
var_dump( gmdate($format, $timestamp, $extra_arg) );

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : error conditions ***

-- Testing gmdate() function with Zero arguments --

Warning: gmdate() expects at least 1 parameter, 0 given in %s on line %d
bool(false)

-- Testing gmdate() function with more than expected no. of arguments --

Warning: gmdate() expects at most 2 parameters, 3 given in %s on line %d
bool(false)
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation1.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation1.phpt
+++ php-src/ext/date/tests/gmdate_variation1.phpt
--TEST--
Test gmdate() function : usage variation - Passing unexpected values to format 
argument .
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : usage variation ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');
$timestamp = mktime(8, 8, 8, 8, 8, 2008);

//get an unset variable
$unset_var = 10;
unset ($unset_var);

// define some classes
class classWithToString
{
        public function __toString() {
                return "Class A object";
        }
}

class classWithoutToString
{
}

// heredoc string
$heredoc = <<<EOT
hello world
EOT;

// add arrays
$index_array = array (1, 2, 3);
$assoc_array = array ('one' => 1, 'two' => 2);

//array of values to iterate over
$inputs = array(

      // int data
      'int 0' => 0,
      'int 1' => 1,
      'int 12345' => 12345,
      'int -12345' => -12345,

      // float data
      'float 10.5' => 10.5,
      'float -10.5' => -10.5,
      'float 12.3456789000e10' => 12.3456789000e10,
      'float -12.3456789000e10' => -12.3456789000e10,
      'float .5' => .5,

      // array data
      'empty array' => array(),
      'int indexed array' => $index_array,
      'associative array' => $assoc_array,
      'nested arrays' => array('foo', $index_array, $assoc_array),

      // null data
      'uppercase NULL' => NULL,
      'lowercase null' => null,

      // boolean data
      'lowercase true' => true,
      'lowercase false' =>false,
      'uppercase TRUE' =>TRUE,
      'uppercase FALSE' =>FALSE,

      // empty data
      'empty string DQ' => "",
      'empty string SQ' => '',

      // object data
      'instance of classWithToString' => new classWithToString(),
      'instance of classWithoutToString' => new classWithoutToString(),

      // undefined data
      'undefined var' => @$undefined_var,

      // unset data
      'unset var' => @$unset_var,
);

// loop through each element of the array for format

foreach($inputs as $key =>$value) {
      echo "\n--$key--\n";
      var_dump( gmdate($value, $timestamp) );
      var_dump( gmdate($value) );
};

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***

--int 0--
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: gmdate() expects parameter 1 to be binary string, array given in %s on 
line %d
bool(false)

Warning: gmdate() expects parameter 1 to be binary string, array given in %s on 
line %d
bool(false)

--int indexed array--

Warning: gmdate() expects parameter 1 to be binary string, array given in %s on 
line %d
bool(false)

Warning: gmdate() expects parameter 1 to be binary string, array given in %s on 
line %d
bool(false)

--associative array--

Warning: gmdate() expects parameter 1 to be binary string, array given in %s on 
line %d
bool(false)

Warning: gmdate() expects parameter 1 to be binary string, array given in %s on 
line %d
bool(false)

--nested arrays--

Warning: gmdate() expects parameter 1 to be binary string, array given in %s on 
line %d
bool(false)

Warning: gmdate() expects parameter 1 to be binary string, array given in %s on 
line %d
bool(false)

--uppercase NULL--
unicode(0) ""
unicode(0) ""

--lowercase null--
unicode(0) ""
unicode(0) ""

--lowercase true--
unicode(1) "1"
unicode(1) "1"

--lowercase false--
unicode(0) ""
unicode(0) ""

--uppercase TRUE--
unicode(1) "1"
unicode(1) "1"

--uppercase FALSE--
unicode(0) ""
unicode(0) ""

--empty string DQ--
unicode(0) ""
unicode(0) ""

--empty string SQ--
unicode(0) ""
unicode(0) ""

--instance of classWithToString--
unicode(53) "CFridayam0808 AM 2008b8UTC2008-08-08T08:08:08+00:0031"
unicode(%d) "%s"

--instance of classWithoutToString--

Warning: gmdate() expects parameter 1 to be binary string, object given in %s 
on line %d
bool(false)

Warning: gmdate() expects parameter 1 to be binary string, object given in %s 
on line %d
bool(false)

--undefined var--
unicode(0) ""
unicode(0) ""

--unset var--
unicode(0) ""
unicode(0) ""
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation2.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation2.phpt
+++ php-src/ext/date/tests/gmdate_variation2.phpt
--TEST--
Test gmdate() function : usage variation - Passing unexpected values to 
timestamp argument.
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : usage variation ***\n";


// Initialise all required variables
date_default_timezone_set('UTC');
$format = DATE_ISO8601;

//get an unset variable
$unset_var = 10;
unset ($unset_var);

// define some classes
class classWithToString
{
        public function __toString() {
                return "Class A object";
        }
}

class classWithoutToString
{
}

// heredoc string
$heredoc = <<<EOT
hello world
EOT;

// add arrays
$index_array = array (1, 2, 3);
$assoc_array = array ('one' => 1, 'two' => 2);

//array of values to iterate over
$inputs = array(

      // int data
      'int 0' => 0,
      'int 1' => 1,
      'int 12345' => 12345,
      'int -12345' => -12345,

      // float data
      'float 10.5' => 10.5,
      'float -10.5' => -10.5,
      'float .5' => .5,

      // array data
      'empty array' => array(),
      'int indexed array' => $index_array,
      'associative array' => $assoc_array,
      'nested arrays' => array('foo', $index_array, $assoc_array),

      // null data
      'uppercase NULL' => NULL,
      'lowercase null' => null,

      // boolean data
      'lowercase true' => true,
      'lowercase false' =>false,
      'uppercase TRUE' =>TRUE,
      'uppercase FALSE' =>FALSE,

      // empty data
      'empty string DQ' => "",
      'empty string SQ' => '',

      // string data
      'string DQ' => "string",
      'string SQ' => 'string',
      'mixed case string' => "sTrInG",
      'heredoc' => $heredoc,

      // object data
      'instance of classWithToString' => new classWithToString(),
      'instance of classWithoutToString' => new classWithoutToString(),

      // undefined data
      'undefined var' => @$undefined_var,

      // unset data
      'unset var' => @$unset_var,
);

// loop through each element of the array for timestamp

foreach($inputs as $key =>$value) {
      echo "\n--$key--\n";
      var_dump( gmdate($format, $value) );
};

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***

--int 0--
unicode(24) "1970-01-01T00:00:00+0000"

--int 1--
unicode(24) "1970-01-01T00:00:01+0000"

--int 12345--
unicode(24) "1970-01-01T03:25:45+0000"

--int -12345--
unicode(24) "1969-12-31T20:34:15+0000"

--float 10.5--
unicode(24) "1970-01-01T00:00:10+0000"

--float -10.5--
unicode(24) "1969-12-31T23:59:50+0000"

--float .5--
unicode(24) "1970-01-01T00:00:00+0000"

--empty array--

Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
bool(false)

--int indexed array--

Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
bool(false)

--associative array--

Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
bool(false)

--nested arrays--

Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
bool(false)

--uppercase NULL--
unicode(24) "1970-01-01T00:00:00+0000"

--lowercase null--
unicode(24) "1970-01-01T00:00:00+0000"

--lowercase true--
unicode(24) "1970-01-01T00:00:01+0000"

--lowercase false--
unicode(24) "1970-01-01T00:00:00+0000"

--uppercase TRUE--
unicode(24) "1970-01-01T00:00:01+0000"

--uppercase FALSE--
unicode(24) "1970-01-01T00:00:00+0000"

--empty string DQ--

Warning: gmdate() expects parameter 2 to be long, Unicode string given in %s on 
line %d
bool(false)

--empty string SQ--

Warning: gmdate() expects parameter 2 to be long, Unicode string given in %s on 
line %d
bool(false)

--string DQ--

Warning: gmdate() expects parameter 2 to be long, Unicode string given in %s on 
line %d
bool(false)

--string SQ--

Warning: gmdate() expects parameter 2 to be long, Unicode string given in %s on 
line %d
bool(false)

--mixed case string--

Warning: gmdate() expects parameter 2 to be long, Unicode string given in %s on 
line %d
bool(false)

--heredoc--

Warning: gmdate() expects parameter 2 to be long, Unicode string given in %s on 
line %d
bool(false)

--instance of classWithToString--

Warning: gmdate() expects parameter 2 to be long, object given in %s on line %d
bool(false)

--instance of classWithoutToString--

Warning: gmdate() expects parameter 2 to be long, object given in %s on line %d
bool(false)

--undefined var--
unicode(24) "1970-01-01T00:00:00+0000"

--unset var--
unicode(24) "1970-01-01T00:00:00+0000"
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_basic.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_basic.phpt
+++ php-src/ext/date/tests/gmdate_basic.phpt
--TEST--
Test gmdate() function : basic functionality 
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : basic functionality ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');
$format = DATE_ISO8601;
$timestamp = mktime(8, 8, 8, 8, 8, 2008);

// Calling gmdate() with all possible arguments
var_dump( gmdate($format, $timestamp) );

// Calling gmdate() with mandatory arguments
var_dump( gmdate($format) );

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : basic functionality ***
unicode(24) "2008-08-08T08:08:08+0000"
unicode(%d) "%s"
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation3.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation3.phpt
+++ php-src/ext/date/tests/gmdate_variation3.phpt
--TEST--
Test gmdate() function : usage variation - Passing numeric representation of 
day formats.
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : usage variation ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');
$timestamp = mktime(8, 8, 8, 8, 8, 2008);

//array of values to iterate over
$inputs = array(

         'Day with leading zeros' => 'd',
         'Day without leading zeros' => 'j',
         'ISO representation' => 'N',
         'Numeric representation of day' => 'w',
         'Day of the year' => 'z'
);

// loop through each element of the array for timestamp

foreach($inputs as $key =>$value) {
      echo "\n--$key--\n";
      var_dump( gmdate($value) );
      var_dump( gmdate($value, $timestamp) );
};

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***

--Day with leading zeros--
unicode(%d) "%d"
unicode(2) "08"

--Day without leading zeros--
unicode(%d) "%d"
unicode(1) "8"

--ISO representation--
unicode(%d) "%d"
unicode(1) "5"

--Numeric representation of day--
unicode(%d) "%d"
unicode(1) "5"

--Day of the year--
unicode(%d) "%d"
unicode(3) "220"
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation4.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation4.phpt
+++ php-src/ext/date/tests/gmdate_variation4.phpt
--TEST--
Test gmdate() function : usage variation - Passing textual representation of 
day formats.
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : usage variation ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');
$timestamp = mktime(8, 8, 8, 8, 8, 2008);

echo "\n-- Testing gmdate() function with partial textual representation of day 
--\n";
var_dump( gmdate('D') );
var_dump( gmdate('D', $timestamp) );

echo "\n-- Testing gmdate() function with full textual representation of day 
--\n";
var_dump( gmdate('l') );
var_dump( gmdate('l', $timestamp) );

echo "\n-- Testing gmdate() function with English ordinal suffix --\n";
var_dump( gmdate('S') );
var_dump( gmdate('S', $timestamp) );

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***

-- Testing gmdate() function with partial textual representation of day --
unicode(%d) "%s"
unicode(3) "Fri"

-- Testing gmdate() function with full textual representation of day --
unicode(%d) "%s"
unicode(6) "Friday"

-- Testing gmdate() function with English ordinal suffix --
unicode(%d) "%s"
unicode(2) "th"
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation5.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation5.phpt
+++ php-src/ext/date/tests/gmdate_variation5.phpt
--TEST--
Test gmdate() function : usage variation - Passing Week representation to 
format.
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : usage variation ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');
$timestamp = mktime(8, 8, 8, 8, 8, 2008);

echo "\n-- Testing gmdate() function with ISO-8601 week number of year format 
--\n";
var_dump( gmdate('W') );
var_dump( gmdate('W', $timestamp) );

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***

-- Testing gmdate() function with ISO-8601 week number of year format --
unicode(%d) "%d"
unicode(2) "32"
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/gmdate_variation6.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/gmdate_variation6.phpt
+++ php-src/ext/date/tests/gmdate_variation6.phpt
--TEST--
Test gmdate() function : usage variation - Passing Month format options to 
format argument.
--FILE--
<?php
/* Prototype  : string gmdate(string format [, long timestamp])
 * Description: Format a GMT date/time 
 * Source code: ext/date/php_date.c
 * Alias to functions: 
 */

echo "*** Testing gmdate() : usage variation ***\n";

// Initialise all required variables
date_default_timezone_set('UTC');
$timestamp = mktime(8, 8, 8, 8, 8, 2008);

echo "\n-- Testing gmdate() function with full textual representation of month 
format --\n";
var_dump( gmdate('F') );
var_dump( gmdate('F', $timestamp) );

echo "\n-- Testing gmdate() function with numeric representation of month 
format --\n";
var_dump( gmdate('m') );
var_dump( gmdate('m', $timestamp) );

echo "\n-- Testing gmdate() function with short textual representation of month 
format --\n";
var_dump( gmdate('M') );
var_dump( gmdate('M', $timestamp) );

echo "\n-- Testing gmdate() function with numeric representation of month 
without leading zeros format --\n";
var_dump( gmdate('n') );
var_dump( gmdate('n', $timestamp) );

echo "\n-- Testing gmdate() function with number of days in a month format 
--\n";
var_dump( gmdate('t') );
var_dump( gmdate('t', $timestamp) );

?>
===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***

-- Testing gmdate() function with full textual representation of month format --
unicode(%d) "%s"
unicode(6) "August"

-- Testing gmdate() function with numeric representation of month format --
unicode(%d) "%d"
unicode(2) "08"

-- Testing gmdate() function with short textual representation of month format 
--
unicode(%d) "%s"
unicode(3) "Aug"

-- Testing gmdate() function with numeric representation of month without 
leading zeros format --
unicode(%d) "%d"
unicode(1) "8"

-- Testing gmdate() function with number of days in a month format --
unicode(%d) "%d"
unicode(2) "31"
===DONE===

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to