Return to dir_variation6.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / dir |
1.1 misho 1: --TEST-- 2: Test dir() function : usage variations - non-existent directory 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: 11: /* 12: * Passing a non-existent directory as argument to dir() function 13: * and checking to see if proper warning message is output. 14: */ 15: echo "*** Testing dir() : open a non-existent directory ***\n"; 16: 17: // create the temporary directory 18: $file_path = dirname(__FILE__); 19: $dir_path = $file_path."/dir_variation6"; 20: @mkdir($dir_path); 21: 22: // open existent directory 23: $d = dir($dir_path); 24: $d->close(); //close the dir 25: 26: // remove directory and try to open the same(non-existent) directory again 27: rmdir($dir_path); 28: clearstatcache(); 29: 30: echo "-- opening previously removed directory --\n"; 31: var_dump( dir($dir_path) ); 32: 33: // point to a non-existent directory 34: $non_existent_dir = $file_path."/non_existent_dir"; 35: echo "-- opening non-existent directory --\n"; 36: $d = dir($non_existent_dir); 37: var_dump( $d ); 38: 39: echo "Done"; 40: ?> 41: --EXPECTF-- 42: *** Testing dir() : open a non-existent directory *** 43: -- opening previously removed directory -- 44: 45: Warning: dir(%s): failed to open dir: %s in %s on line %d 46: bool(false) 47: -- opening non-existent directory -- 48: 49: Warning: dir(%s): failed to open dir: %s in %s on line %d 50: bool(false) 51: Done