1--TEST--
2IntlDateFormatter::formatObject(): error conditions
3--SKIPIF--
4<?php
5if (!extension_loaded('intl'))
6	die('skip intl extension not enabled');
7--FILE--
8<?php
9ini_set("intl.error_level", E_WARNING);
10ini_set("intl.default_locale", "pt_PT");
11ini_set("date.timezone", "Europe/Lisbon");
12
13var_dump(IntlDateFormatter::formatObject());
14var_dump(IntlDateFormatter::formatObject(1));
15var_dump(IntlDateFormatter::formatObject(new stdclass));
16
17class A extends IntlCalendar {function __construct(){}}
18var_dump(IntlDateFormatter::formatObject(new A));
19class B extends DateTime {function __construct(){}}
20var_dump(IntlDateFormatter::formatObject(new B));
21
22$cal = IntlCalendar::createInstance();
23var_dump(IntlDateFormatter::formatObject($cal, -2));
24var_dump(IntlDateFormatter::formatObject($cal, array()));
25var_dump(IntlDateFormatter::formatObject($cal, array(1,2,3)));
26var_dump(IntlDateFormatter::formatObject($cal, array(array(), 1)));
27var_dump(IntlDateFormatter::formatObject($cal, array(1, -2)));
28var_dump(IntlDateFormatter::formatObject($cal, ""));
29var_dump(IntlDateFormatter::formatObject($cal, "YYYY", array()));
30
31?>
32==DONE==
33
34--EXPECTF--
35
36Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d
37bool(false)
38
39Warning: IntlDateFormatter::formatObject() expects parameter 1 to be object, integer given in %s on line %d
40bool(false)
41
42Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the passed object must be an instance of either IntlCalendar or DateTime in %s on line %d
43bool(false)
44
45Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad IntlCalendar instance: not initialized properly in %s on line %d
46bool(false)
47
48Warning: DateTime::getTimestamp(): The DateTime object has not been correctly initialized by its constructor in %s on line %d
49
50Warning: IntlDateFormatter::formatObject(): datefmt_format_object: error calling ::getTimeStamp() on the object in %s on line %d
51bool(false)
52
53Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the date/time format type is invalid in %s on line %d
54bool(false)
55
56Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad format; if array, it must have two elements in %s on line %d
57bool(false)
58
59Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad format; if array, it must have two elements in %s on line %d
60bool(false)
61
62Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad format; the date format (first element of the array) is not valid in %s on line %d
63bool(false)
64
65Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad format; the time format (second element of the array) is not valid in %s on line %d
66bool(false)
67
68Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the format is empty in %s on line %d
69bool(false)
70
71Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d
72bool(false)
73==DONE==
74
75