Annotation of embedaddon/php/ext/standard/tests/file/readlink_realpath_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test readlink() and realpath() functions: error conditions
3: --SKIPIF--
4: <?php
5: if (substr(PHP_OS, 0, 3) == 'WIN') {
6: die('skip no symlinks on Windows');
7: }
8: ?>
9: --FILE--
10: <?php
11: /* Prototype: string readlink ( string $path );
12: Description: Returns the target of a symbolic link
13:
14: Prototype: string realpath ( string $path );
15: Description: Returns canonicalized absolute pathname
16: */
17:
18: echo "*** Testing readlink(): error conditions ***\n";
19: var_dump( readlink() ); // args < expected
20: var_dump( readlink(__FILE__, 2) ); // args > expected
21:
22: echo "\n*** Testing readlink() on a non-existent link ***\n";
23: var_dump( readlink(dirname(__FILE__)."/readlink_error.tmp") );
24:
25: echo "\n*** Testing readlink() on existing file ***\n";
26: var_dump( readlink(__FILE__) );
27:
28: echo "\n*** Testing readlink() on existing directory ***\n";
29: var_dump( readlink(dirname(__FILE__)) );
30:
31: echo "*** Testing realpath(): error conditions ***\n";
32: var_dump( realpath() ); // args < expected
33: var_dump( realpath(1, 2) ); // args > expected
34:
35: echo "\n*** Testing realpath() on a non-existent file ***\n";
36: var_dump( realpath(dirname(__FILE__)."/realpath_error.tmp") );
37:
38: echo "Done\n";
39: ?>
40: --EXPECTF--
41: *** Testing readlink(): error conditions ***
42:
43: Warning: readlink() expects exactly 1 parameter, 0 given in %s on line %d
44: NULL
45:
46: Warning: readlink() expects exactly 1 parameter, 2 given in %s on line %d
47: NULL
48:
49: *** Testing readlink() on a non-existent link ***
50:
51: Warning: readlink(): No such file or directory in %s on line %d
52: bool(false)
53:
54: *** Testing readlink() on existing file ***
55:
56: Warning: readlink(): Invalid argument in %s on line %d
57: bool(false)
58:
59: *** Testing readlink() on existing directory ***
60:
61: Warning: readlink(): Invalid argument in %s on line %d
62: bool(false)
63: *** Testing realpath(): error conditions ***
64:
65: Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d
66: NULL
67:
68: Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d
69: NULL
70:
71: *** Testing realpath() on a non-existent file ***
72: %s
73: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>