1
0
mirror of https://github.com/php/php-src.git synced 2026-03-27 09:42:22 +01:00
Files
archived-php-src/ext/date/tests/date_error.phpt
Gabriel Caruso ce1d69a1f6 Use int instead of integer in type errors
PHP requires integer typehints to be written "int" and does not
allow "integer" as an alias. This changes type error messages to
match the actual type name and avoids confusing messages like
"must be of the type integer, integer given".
2018-02-04 19:08:23 +01:00

40 lines
1023 B
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 int, string given in %s on line %d
bool(false)
===DONE===