xref: /PHP-5.5/ext/standard/tests/dir/dir_error.phpt (revision 7c75fe7b)
1--TEST--
2Test dir() function : error conditions
3--FILE--
4<?php
5/*
6 * Prototype  : object dir(string $directory[, resource $context])
7 * Description: Directory class with properties, handle and class and methods read, rewind and close
8 * Source code: ext/standard/dir.c
9 */
10
11echo "*** Testing dir() : error conditions ***\n";
12
13// Zero arguments
14echo "\n-- Testing dir() function with zero arguments --";
15var_dump( dir() );
16
17// With one more than expected number of arguments
18echo "\n-- Testing dir() function with one more than expected number of arguments --";
19$extra_arg = 10;
20var_dump( dir(getcwd(), "stream", $extra_arg) );
21
22echo "Done";
23?>
24--EXPECTF--
25*** Testing dir() : error conditions ***
26
27-- Testing dir() function with zero arguments --
28Warning: dir() expects at least 1 parameter, 0 given in %s on line %d
29NULL
30
31-- Testing dir() function with one more than expected number of arguments --
32Warning: dir() expects at most 2 parameters, 3 given in %s on line %d
33NULL
34Done
35