xref: /PHP-5.5/ext/date/tests/gmdate_error.phpt (revision ccef11d6)
1--TEST--
2Test gmdate() function : error conditions
3--FILE--
4<?php
5/* Prototype  : string gmdate(string format [, long timestamp])
6 * Description: Format a GMT date/time
7 * Source code: ext/date/php_date.c
8 * Alias to functions:
9 */
10
11echo "*** Testing gmdate() : error conditions ***\n";
12
13// Initialise all required variables
14date_default_timezone_set('UTC');
15$format = DATE_ISO8601;
16$timestamp = mktime(8, 8, 8, 8, 8, 2008);
17
18// Zero arguments
19echo "\n-- Testing gmdate() function with Zero arguments --\n";
20var_dump( gmdate() );
21
22//Test gmdate with one more than the expected number of arguments
23echo "\n-- Testing gmdate() function with more than expected no. of arguments --\n";
24$extra_arg = 10;
25var_dump( gmdate($format, $timestamp, $extra_arg) );
26
27?>
28===DONE===
29--EXPECTF--
30*** Testing gmdate() : error conditions ***
31
32-- Testing gmdate() function with Zero arguments --
33
34Warning: gmdate() expects at least 1 parameter, 0 given in %s on line %d
35bool(false)
36
37-- Testing gmdate() function with more than expected no. of arguments --
38
39Warning: gmdate() expects at most 2 parameters, 3 given in %s on line %d
40bool(false)
41===DONE===
42