Return to is_dir_variation4.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test is_dir() function: usage variations - diff. path notations 3: --FILE-- 4: <?php 5: /* Prototype: bool is_dir ( string $dirname ); 6: Description: Tells whether the dirname is a directory 7: Returns TRUE if the dirname exists and is a directory, FALSE otherwise. 8: */ 9: 10: /* Passing dir names with different notations, using slashes, wild-card chars */ 11: 12: $file_path = dirname(__FILE__); 13: 14: echo "*** Testing is_dir() with different notations of dir names ***"; 15: $dir_name = "/is_dir_variation4"; 16: mkdir($file_path.$dir_name); 17: 18: $dirs_arr = array( 19: "is_dir_variation4", 20: "./is_dir_variation4", 21: 22: /* Testing a file trailing slash */ 23: "is_dir_variation4/", 24: "./is_dir_variation4/", 25: 26: /* Testing file with double trailing slashes */ 27: "is_dir_variation4//", 28: "./is_dir_variation4//", 29: ".//is_dir_variation4//", 30: "is_dir_vari*", 31: 32: /* Testing Binary safe */ 33: "./is_dir_variation4/".chr(0), 34: "is_dir_variation4\0" 35: ); 36: 37: $count = 1; 38: /* loop through to test each element the above array */ 39: foreach($dirs_arr as $dir) { 40: echo "\n-- Iteration $count --\n"; 41: var_dump( is_dir($file_path."/".$dir ) ); 42: $count++; 43: } 44: 45: echo "\n*** Done ***"; 46: ?> 47: --CLEAN-- 48: <?php 49: $file_path = dirname(__FILE__); 50: $dir_name = $file_path."/is_dir_variation4"; 51: rmdir($dir_name); 52: ?> 53: --EXPECTF-- 54: *** Testing is_dir() with different notations of dir names *** 55: -- Iteration 1 -- 56: bool(true) 57: 58: -- Iteration 2 -- 59: bool(true) 60: 61: -- Iteration 3 -- 62: bool(true) 63: 64: -- Iteration 4 -- 65: bool(true) 66: 67: -- Iteration 5 -- 68: bool(true) 69: 70: -- Iteration 6 -- 71: bool(true) 72: 73: -- Iteration 7 -- 74: bool(true) 75: 76: -- Iteration 8 -- 77: bool(false) 78: 79: -- Iteration 9 -- 80: bool(false) 81: 82: -- Iteration 10 -- 83: bool(false) 84: 85: *** Done ***