1--TEST--
2Test DateTime::format() function : error conditions
3--FILE--
4<?php
5/* Prototype  : public string DateTime::format  ( string $format  )
6 * Description: Returns date formatted according to given format
7 * Source code: ext/date/php_date.c
8 * Alias to functions: date_format
9 */
10
11//Set the default time zone
12date_default_timezone_set("Europe/London");
13
14// Craete a date object
15$date = new DateTime("2005-07-14 22:30:41");
16
17echo "*** Testing DateTime::format() : error conditions ***\n";
18
19echo "\n-- Testing date_date_formatcreate() function with zero arguments --\n";
20var_dump( $date->format() );
21
22echo "\n-- Testing date_date_formatcreate() function with more than expected no. of arguments --\n";
23$format = "F j, Y, g:i a";
24$extra_arg = 10;
25var_dump( $date->format($format, $extra_arg) );
26
27?>
28===DONE===
29--EXPECTF--
30*** Testing DateTime::format() : error conditions ***
31
32-- Testing date_date_formatcreate() function with zero arguments --
33
34Warning: DateTime::format() expects exactly 1 parameter, 0 given in %s on line %d
35bool(false)
36
37-- Testing date_date_formatcreate() function with more than expected no. of arguments --
38
39Warning: DateTime::format() expects exactly 1 parameter, 2 given in %s on line %d
40bool(false)
41===DONE===
42