Annotation of embedaddon/php/ext/standard/tests/file/readlink_variation1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test readlink() function: usage variations - invalid filenames
3: --CREDITS--
4: Dave Kelsey <d_kelsey@uk.ibm.com>
5: --SKIPIF--
6: <?php
7: if (substr(PHP_OS, 0, 3) == 'WIN') {
8: die('skip no links on Windows');
9: }
10: ?>
11: --FILE--
12: <?php
13: /* Prototype: string readlink ( string $path );
14: Description: Returns the target of a symbolic link */
15:
16: /* Testing readlink() with invalid arguments -int, float, bool, NULL, resource */
17:
18: $file_path = dirname(__FILE__);
19: $file_handle = fopen($file_path."/readlink_variation2.tmp", "w");
20:
21: echo "*** Testing Invalid file types ***\n";
22: $filenames = array(
23: /* Invalid filenames */
24: -2.34555,
25: "",
26: TRUE,
27: FALSE,
28: NULL,
29: $file_handle,
30:
31: /* scalars */
32: 1234,
33: 0
34: );
35:
36: /* loop through to test each element the above array */
37: foreach( $filenames as $filename ) {
38: var_dump( readlink($filename) );
39: clearstatcache();
40: }
41: fclose($file_handle);
42:
43: echo "\n*** Done ***";
44: ?>
45: --CLEAN--
46: <?php
47: $file_path = dirname(__FILE__);
48: unlink($file_path."/readlink_variation2.tmp");
49: ?>
50: --EXPECTF--
51: *** Testing Invalid file types ***
52:
53: Warning: readlink(): %s in %s on line %d
54: bool(false)
55:
56: Warning: readlink(): %s in %s on line %d
57: bool(false)
58:
59: Warning: readlink(): %s in %s on line %d
60: bool(false)
61:
62: Warning: readlink(): %s in %s on line %d
63: bool(false)
64:
65: Warning: readlink(): %s in %s on line %d
66: bool(false)
67:
68: Warning: readlink() expects parameter 1 to be string, resource given in %s on line %d
69: NULL
70:
71: Warning: readlink(): %s in %s on line %d
72: bool(false)
73:
74: Warning: readlink(): %s in %s on line %d
75: bool(false)
76:
77: *** Done ***
78:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>