Return to rmdir_variation1.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test rmdir() function : usage variation - invalid file names 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 Not valid for Windows"); 9: ?> 10: --FILE-- 11: <?php 12: /* Prototype : bool rmdir(string dirname[, resource context]) 13: * Description: Remove a directory 14: * Source code: ext/standard/file.c 15: * Alias to functions: 16: */ 17: 18: echo "*** Testing rmdir() : usage variation ***\n"; 19: 20: // Define error handler 21: function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { 22: if (error_reporting() != 0) { 23: // report non-silenced errors 24: echo "Error: $err_no - $err_msg, $filename($linenum)\n"; 25: } 26: } 27: set_error_handler('test_error_handler'); 28: 29: 30: //get an unset variable 31: $unset_var = 10; 32: unset ($unset_var); 33: 34: // define some classes 35: class classWithToString 36: { 37: public function __toString() { 38: return "Class A object"; 39: } 40: } 41: 42: class classWithoutToString 43: { 44: } 45: 46: // heredoc string 47: $heredoc = <<<EOT 48: hello world 49: EOT; 50: 51: // add arrays 52: $index_array = array (1, 2, 3); 53: $assoc_array = array ('one' => 1, 'two' => 2); 54: 55: //array of values to iterate over 56: $inputs = array( 57: 58: // null data 59: 'uppercase NULL' => NULL, 60: 'lowercase null' => null, 61: 62: // boolean data 63: 'lowercase false' =>false, 64: 'uppercase FALSE' =>FALSE, 65: 66: // empty data 67: 'empty string DQ' => "", 68: 'empty string SQ' => '', 69: 70: // undefined data 71: 'undefined var' => @$undefined_var, 72: 73: // unset data 74: 'unset var' => @$unset_var, 75: 76: // other 77: 'single space' => ' ', 78: ); 79: 80: // loop through each element of the array for dirname 81: 82: foreach($inputs as $key =>$value) { 83: echo "\n--$key--\n"; 84: var_dump(rmdir($value)); 85: }; 86: 87: ?> 88: ===DONE=== 89: --EXPECTF-- 90: *** Testing rmdir() : usage variation *** 91: 92: --uppercase NULL-- 93: Error: 2 - rmdir(): %s, %s(%d) 94: bool(false) 95: 96: --lowercase null-- 97: Error: 2 - rmdir(): %s, %s(%d) 98: bool(false) 99: 100: --lowercase false-- 101: Error: 2 - rmdir(): %s, %s(%d) 102: bool(false) 103: 104: --uppercase FALSE-- 105: Error: 2 - rmdir(): %s, %s(%d) 106: bool(false) 107: 108: --empty string DQ-- 109: Error: 2 - rmdir(): %s, %s(%d) 110: bool(false) 111: 112: --empty string SQ-- 113: Error: 2 - rmdir(): %s, %s(%d) 114: bool(false) 115: 116: --undefined var-- 117: Error: 2 - rmdir(): %s, %s(%d) 118: bool(false) 119: 120: --unset var-- 121: Error: 2 - rmdir(): %s, %s(%d) 122: bool(false) 123: 124: --single space-- 125: Error: 2 - rmdir( ): %s, %s(%d) 126: bool(false) 127: ===DONE===