xref: /PHP-5.4/ext/date/tests/mktime_error.phpt (revision a2e47734)
1--TEST--
2Test mktime() function : error conditions
3--FILE--
4<?php
5/* Prototype  : int mktime  ([ int $hour= date("H")  [, int $minute= date("i")  [, int $second= date("s")  [, int $month= date("n")  [, int $day= date("j")  [, int $year= date("Y")  [, int $is_dst= -1  ]]]]]]] )
6 * Description: Get Unix timestamp for a date
7 * Source code: ext/date/php_date.c
8 * Alias to functions:
9 */
10error_reporting(E_ALL | E_STRICT);
11
12//Set the default time zone
13date_default_timezone_set("Europe/London");
14
15echo "*** Testing mktime() : error conditions ***\n";
16
17echo "\n-- Testing mktime() function with Zero arguments --\n";
18var_dump( mktime() );
19
20echo "\n-- Testing mktime() function with more than expected no. of arguments --\n";
21$hour = 10;
22$minute = 30;
23$sec = 45;
24$month = 7;
25$day = 2;
26$year = 1963;
27$is_dst = 0;
28$extra_arg = 10;
29var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $is_dst, $extra_arg) );
30
31?>
32===DONE===
33--EXPECTF--
34*** Testing mktime() : error conditions ***
35
36-- Testing mktime() function with Zero arguments --
37
38Strict Standards: mktime(): You should be using the time() function instead in %s on line %d
39int(%d)
40
41-- Testing mktime() function with more than expected no. of arguments --
42
43Warning: mktime() expects at most 7 parameters, 8 given in %s on line %d
44bool(false)
45===DONE===
46