xref: /PHP-7.0/ext/date/tests/date_error.phpt (revision e5eb9530)
1--TEST--
2Test date() function : error conditions
3--FILE--
4<?php
5/* Prototype  : string date  ( string $format  [, int $timestamp  ] )
6 * Description: Format a local time/date.
7 * Source code: ext/date/php_date.c
8 */
9
10echo "*** Testing date() : error conditions ***\n";
11
12//Set the default time zone
13date_default_timezone_set("America/Chicago");
14
15$format = "m.d.y";
16$timestamp = mktime(10, 44, 30, 2, 27, 2009);
17
18echo "\n-- Testing date function with no arguments --\n";
19var_dump (date());
20
21echo "\n-- Testing date function with more than expected no. of arguments --\n";
22$extra_arg = true;
23var_dump (checkdate($format, $timestamp, $extra_arg));
24
25?>
26===DONE===
27--EXPECTF--
28*** Testing date() : error conditions ***
29
30-- Testing date function with no arguments --
31
32Warning: date() expects at least 1 parameter, 0 given in %s on line %d
33bool(false)
34
35-- Testing date function with more than expected no. of arguments --
36
37Warning: checkdate() expects parameter 1 to be integer, string given in %s on line %d
38bool(false)
39===DONE===
40