xref: /PHP-7.4/ext/date/tests/mktime_error.phpt (revision d7a3edd4)
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 */
10
11//Set the default time zone
12date_default_timezone_set("Europe/London");
13
14echo "*** Testing mktime() : error conditions ***\n";
15
16echo "\n-- Testing mktime() function with Zero arguments --\n";
17var_dump( mktime() );
18
19echo "\n-- Testing mktime() function with more than expected no. of arguments --\n";
20$hour = 10;
21$minute = 30;
22$sec = 45;
23$month = 7;
24$day = 2;
25$year = 1963;
26$extra_arg = 10;
27var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) );
28
29?>
30===DONE===
31--EXPECTF--
32*** Testing mktime() : error conditions ***
33
34-- Testing mktime() function with Zero arguments --
35
36Deprecated: mktime(): You should be using the time() function instead in %s on line %d
37int(%d)
38
39-- Testing mktime() function with more than expected no. of arguments --
40
41Warning: mktime() expects at most 6 parameters, 7 given in %s on line %d
42bool(false)
43===DONE===
44