Return to dir_variation4.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 - operate on previously opened 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: * Testing the behavior of dir() function by trying to open a 13: * directory which is already open. 14: */ 15: 16: echo "*** Testing dir() : operate on previously opened directory ***\n"; 17: 18: // include the file.inc for Function: function create_files() 19: include( dirname(__FILE__)."/../file/file.inc"); 20: 21: // create the temporary directory 22: $file_path = dirname(__FILE__); 23: $dir_path = $file_path."/dir_variation4"; 24: @mkdir($dir_path); 25: 26: // create files within the temporary directory 27: create_files($dir_path, 3, "alphanumeric", 0755, 1, "w", "dir_variation4"); 28: 29: // open the directory 30: $d = dir($dir_path); 31: var_dump( $d ); 32: 33: // open the same directory again without closing it 34: $e = dir($dir_path); 35: var_dump( $e ); 36: 37: echo "-- reading directory contents with previous handle --\n"; 38: var_dump( $d->read() ); // with previous handle 39: 40: echo "-- reading directory contents with current handle --\n"; 41: var_dump( $e->read() ); // with current handle 42: 43: // delete temporary files 44: delete_files($dir_path, 3, "dir_variation4"); 45: echo "Done"; 46: ?> 47: --CLEAN-- 48: <?php 49: $file_path = dirname(__FILE__); 50: $dir_path = $file_path."/dir_variation4"; 51: 52: rmdir($dir_path); 53: ?> 54: --EXPECTF-- 55: *** Testing dir() : operate on previously opened directory *** 56: object(Directory)#%d (2) { 57: ["path"]=> 58: string(%d) "%s/dir_variation4" 59: ["handle"]=> 60: resource(%d) of type (stream) 61: } 62: object(Directory)#%d (2) { 63: ["path"]=> 64: string(%d) "%s/dir_variation4" 65: ["handle"]=> 66: resource(%d) of type (stream) 67: } 68: -- reading directory contents with previous handle -- 69: string(%d) "%s" 70: -- reading directory contents with current handle -- 71: string(%d) "%s" 72: Done