Annotation of embedaddon/php/ext/standard/tests/dir/dir_variation6-win32.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test dir() function : usage variations - non-existent directory
3: --SKIPIF--
4: <?php
5: if (substr(PHP_OS, 0, 3) != 'WIN') {
6: die("skip Valid only on Windows");
7: }
8: ?>
9: --FILE--
10: <?php
11: /*
12: * Prototype : object dir(string $directory[, resource $context])
13: * Description: Directory class with properties, handle and class and methods read, rewind and close
14: * Source code: ext/standard/dir.c
15: */
16:
17: /*
18: * Passing a non-existent directory as argument to dir() function
19: * and checking to see if proper warning message is output.
20: */
21: echo "*** Testing dir() : open a non-existent directory ***\n";
22:
23: // create the temporary directory
24: $file_path = dirname(__FILE__);
25: $dir_path = $file_path."/dir_variation6";
26: @mkdir($dir_path);
27:
28: // open existent directory
29: $d = dir($dir_path);
30: $d->close(); //close the dir
31:
32: // remove directory and try to open the same(non-existent) directory again
33: rmdir($dir_path);
34: clearstatcache();
35:
36: echo "-- opening previously removed directory --\n";
37: var_dump( dir($dir_path) );
38:
39: // point to a non-existent directory
40: $non_existent_dir = $file_path."/non_existent_dir";
41: echo "-- opening non-existent directory --\n";
42: $d = dir($non_existent_dir);
43: var_dump( $d );
44:
45: echo "Done";
46: ?>
47: --EXPECTF--
48: *** Testing dir() : open a non-existent directory ***
49: -- opening previously removed directory --
50:
51: Warning: dir(%s): The system cannot find the file specified. (code: %d) in %s on line %d
52:
53: Warning: dir(%s): failed to open dir: %s in %s on line %d
54: bool(false)
55: -- opening non-existent directory --
56:
57: Warning: dir(%s): The system cannot find the file specified. (code: %d) in %s on line %d
58:
59: Warning: dir(%s): failed to open dir: %s in %s on line %d
60: bool(false)
61: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>