1--TEST--
2IntlCalendar::before()/after(): bad arguments
3--INI--
4date.timezone=Atlantic/Azores
5--SKIPIF--
6<?php
7if (!extension_loaded('intl'))
8    die('skip intl extension not enabled');
9--FILE--
10<?php
11ini_set("intl.error_level", E_WARNING);
12
13$c = new IntlGregorianCalendar(NULL, 'pt_PT');
14
15function eh($errno, $errstr) {
16echo "error: $errno, $errstr\n";
17}
18set_error_handler('eh');
19
20try {
21    var_dump($c->after());
22} catch (Error $ex) {
23    echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
24}
25try {
26    var_dump($c->before());
27} catch (Error $ex) {
28    echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
29}
30
31try {
32    var_dump($c->after(1));
33} catch (Error $ex) {
34    echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
35}
36try {
37    var_dump($c->before(1));
38} catch (Error $ex) {
39    echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
40}
41
42try{
43    var_dump($c->after($c, 1));
44} catch (Error $ex) {
45    echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
46}
47try {
48    var_dump($c->before($c, 1));
49} catch (Error $ex) {
50    echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
51}
52
53try {
54    var_dump(intlcal_after($c));
55} catch (Error $ex) {
56    echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
57}
58try {
59    var_dump(intlcal_before($c));
60} catch (Error $ex) {
61    echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
62}
63?>
64--EXPECT--
65error: 0, IntlCalendar::after() expects exactly 1 argument, 0 given
66
67error: 0, IntlCalendar::before() expects exactly 1 argument, 0 given
68
69error: 0, IntlCalendar::after(): Argument #1 ($other) must be of type IntlCalendar, int given
70
71error: 0, IntlCalendar::before(): Argument #1 ($other) must be of type IntlCalendar, int given
72
73error: 0, IntlCalendar::after() expects exactly 1 argument, 2 given
74
75error: 0, IntlCalendar::before() expects exactly 1 argument, 2 given
76
77error: 0, intlcal_after() expects exactly 2 arguments, 1 given
78
79error: 0, intlcal_before() expects exactly 2 arguments, 1 given
80