source: src/router/php7/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt @ 31874

Last change on this file since 31874 was 31874, checked in by brainslayer, 6 weeks ago

update php

File size: 988 bytes
Line 
1--TEST--
2Call userland function with incorrect number of arguments
3--FILE--
4<?php
5try {
6        function foo($bar) { }
7        foo();
8} catch (\Error $e) {
9        echo get_class($e) . PHP_EOL;
10        echo $e->getMessage() . PHP_EOL;
11}
12
13try {
14        function bar($foo, $bar) { }
15        bar(1);
16} catch (\Error $e) {
17        echo get_class($e) . PHP_EOL;
18        echo $e->getMessage() . PHP_EOL;
19}
20
21function bat(int $foo, string $bar) { }
22
23try {
24        bat(123);
25} catch (\Error $e) {
26        echo get_class($e) . PHP_EOL;
27        echo $e->getMessage() . PHP_EOL;
28}
29
30try {
31        bat("123");
32} catch (\Error $e) {
33        echo get_class($e) . PHP_EOL;
34        echo $e->getMessage() . PHP_EOL;
35}
36--EXPECTF--
37ArgumentCountError
38Too few arguments to function foo(), 0 passed in %s and exactly 1 expected
39ArgumentCountError
40Too few arguments to function bar(), 1 passed in %s and exactly 2 expected
41ArgumentCountError
42Too few arguments to function bat(), 1 passed in %s and exactly 2 expected
43ArgumentCountError
44Too few arguments to function bat(), 1 passed in %s and exactly 2 expected
Note: See TracBrowser for help on using the repository browser.