File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / date / tests / date_error.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:53 2012 UTC (12 years, 6 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Test date() function : error conditions 
--FILE--
<?php
/* Prototype  : string date  ( string $format  [, int $timestamp  ] )
 * Description: Format a local time/date.
 * Source code: ext/date/php_date.c
 */

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

//Set the default time zone 
date_default_timezone_set("America/Chicago");

$format = "m.d.y";
$timestamp = mktime(10, 44, 30, 2, 27, 2009);

echo "\n-- Testing date function with no arguments --\n";
var_dump (date());

echo "\n-- Testing date function with more than expected no. of arguments --\n";
$extra_arg = true;
var_dump (checkdate($format, $timestamp, $extra_arg));

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

-- Testing date function with no arguments --

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

-- Testing date function with more than expected no. of arguments --

Warning: checkdate() expects parameter 1 to be long, string given in %s on line %d
bool(false)
===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>