Return to hebrev_variation2.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / strings |
1.1 misho 1: --TEST-- 2: Test hebrev() function : usage variations - test values for $max_chars_per_line argument 3: --FILE-- 4: <?php 5: 6: /* Prototype : string hebrev ( string $hebrew_text [, int $max_chars_per_line ] ) 7: * Description: Convert logical Hebrew text to visual text 8: * Source code: ext/standard/string.c 9: */ 10: 11: echo "*** Testing hebrev() function: with unexpected inputs for 'max_chars_per_line' argument ***\n"; 12: 13: //get an unset variable 14: $unset_var = 'string_val'; 15: unset($unset_var); 16: 17: //defining a class 18: class sample { 19: public function __toString() { 20: return "sample object"; 21: } 22: } 23: 24: //getting the resource 25: $file_handle = fopen(__FILE__, "r"); 26: 27: // array with different values for $max_chars_per_line 28: $inputs = array ( 29: 30: // integer values 31: /*1*/ 0, 32: 1, 33: 255, 34: 256, 35: 2147483647, 36: -2147483648, 37: 38: // float values 39: /*7*/ 10.5, 40: -20.5, 41: 10.1234567e5, 42: 43: // array values 44: /*10*/ array(), 45: array(0), 46: array(1, 2), 47: 48: // boolean values 49: /*13*/ true, 50: false, 51: TRUE, 52: FALSE, 53: 54: // null values 55: /*17*/ NULL, 56: null, 57: 58: // string values 59: /*19*/ "abc", 60: 'abc', 61: "3abc", 62: "0abc", 63: "0x3", 64: 65: // objects 66: /*24*/ new sample(), 67: 68: // resource 69: /*25*/ $file_handle, 70: 71: // undefined variable 72: /*26*/ @$undefined_var, 73: 74: // unset variable 75: /*27*/ @$unset_var 76: ); 77: 78: // loop through with each element of the $texts array to test hebrev() function 79: $count = 1; 80: 81: $hebrew_text = "The hebrev function converts logical Hebrew text to visual text.\nThe function tries to avoid breaking words.\n"; 82: 83: foreach($inputs as $max_chars_per_line) { 84: echo "-- Iteration $count --\n"; 85: var_dump( hebrev($hebrew_text, $max_chars_per_line) ); 86: $count ++; 87: } 88: 89: fclose($file_handle); //closing the file handle 90: 91: ?> 92: ===DONE=== 93: --EXPECTF-- 94: *** Testing hebrev() function: with unexpected inputs for 'max_chars_per_line' argument *** 95: -- Iteration 1 -- 96: string(109) ".The hebrev function converts logical Hebrew text to visual text 97: .The function tries to avoid breaking words 98: " 99: -- Iteration 2 -- 100: string(109) "xttel uaisv 101: tot ext 102: ewbrHel cagilos rtveonc 103: ontincfuv reebh 104: he.Ts 105: rdwog inakreb 106: idvoa 107: tos ietrn ioctunf 108: he.T 109: " 110: -- Iteration 3 -- 111: string(109) ".The hebrev function converts logical Hebrew text to visual text 112: .The function tries to avoid breaking words 113: " 114: -- Iteration 4 -- 115: string(109) ".The hebrev function converts logical Hebrew text to visual text 116: .The function tries to avoid breaking words 117: " 118: -- Iteration 5 -- 119: string(109) ".The hebrev function converts logical Hebrew text to visual text 120: .The function tries to avoid breaking words 121: " 122: -- Iteration 6 -- 123: string(109) "txet 124: lausiv 125: ot 126: txet 127: werbeH 128: lacigol 129: strevnoc 130: noitcnuf 131: verbeh 132: ehT. 133: sdrow 134: gnikaerb 135: diova 136: ot 137: seirt 138: noitcnuf 139: ehT. 140: " 141: -- Iteration 7 -- 142: string(109) "text 143: to visual 144: text 145: Hebrew 146: logical 147: converts 148: function 149: hebrev 150: .The 151: words 152: breaking 153: to avoid 154: tries 155: function 156: .The 157: " 158: -- Iteration 8 -- 159: string(109) "txet 160: lausiv 161: ot 162: txet 163: werbeH 164: lacigol 165: strevnoc 166: noitcnuf 167: verbeh 168: ehT. 169: sdrow 170: gnikaerb 171: diova 172: ot 173: seirt 174: noitcnuf 175: ehT. 176: " 177: -- Iteration 9 -- 178: string(109) ".The hebrev function converts logical Hebrew text to visual text 179: .The function tries to avoid breaking words 180: " 181: -- Iteration 10 -- 182: 183: Warning: hebrev() expects parameter 2 to be long, array given in %s on line %d 184: NULL 185: -- Iteration 11 -- 186: 187: Warning: hebrev() expects parameter 2 to be long, array given in %s on line %d 188: NULL 189: -- Iteration 12 -- 190: 191: Warning: hebrev() expects parameter 2 to be long, array given in %s on line %d 192: NULL 193: -- Iteration 13 -- 194: string(109) "xttel uaisv 195: tot ext 196: ewbrHel cagilos rtveonc 197: ontincfuv reebh 198: he.Ts 199: rdwog inakreb 200: idvoa 201: tos ietrn ioctunf 202: he.T 203: " 204: -- Iteration 14 -- 205: string(109) ".The hebrev function converts logical Hebrew text to visual text 206: .The function tries to avoid breaking words 207: " 208: -- Iteration 15 -- 209: string(109) "xttel uaisv 210: tot ext 211: ewbrHel cagilos rtveonc 212: ontincfuv reebh 213: he.Ts 214: rdwog inakreb 215: idvoa 216: tos ietrn ioctunf 217: he.T 218: " 219: -- Iteration 16 -- 220: string(109) ".The hebrev function converts logical Hebrew text to visual text 221: .The function tries to avoid breaking words 222: " 223: -- Iteration 17 -- 224: string(109) ".The hebrev function converts logical Hebrew text to visual text 225: .The function tries to avoid breaking words 226: " 227: -- Iteration 18 -- 228: string(109) ".The hebrev function converts logical Hebrew text to visual text 229: .The function tries to avoid breaking words 230: " 231: -- Iteration 19 -- 232: 233: Warning: hebrev() expects parameter 2 to be long, string given in %s on line %d 234: NULL 235: -- Iteration 20 -- 236: 237: Warning: hebrev() expects parameter 2 to be long, string given in %s on line %d 238: NULL 239: -- Iteration 21 -- 240: 241: Notice: A non well formed numeric value encountered in %s on line %d 242: string(109) "textual vis 243: to 244: textrew Heb 245: icallog 246: ertsconvion unctf 247: brevhe 248: .Therds 249: wo 250: kingbreaoid av 251: to 252: riest 253: tionfuncThe . 254: " 255: -- Iteration 22 -- 256: 257: Notice: A non well formed numeric value encountered in %s on line %d 258: string(109) ".The hebrev function converts logical Hebrew text to visual text 259: .The function tries to avoid breaking words 260: " 261: -- Iteration 23 -- 262: string(109) "textual vis 263: to 264: textrew Heb 265: icallog 266: ertsconvion unctf 267: brevhe 268: .Therds 269: wo 270: kingbreaoid av 271: to 272: riest 273: tionfuncThe . 274: " 275: -- Iteration 24 -- 276: 277: Warning: hebrev() expects parameter 2 to be long, object given in %s on line %d 278: NULL 279: -- Iteration 25 -- 280: 281: Warning: hebrev() expects parameter 2 to be long, resource given in %s on line %d 282: NULL 283: -- Iteration 26 -- 284: string(109) ".The hebrev function converts logical Hebrew text to visual text 285: .The function tries to avoid breaking words 286: " 287: -- Iteration 27 -- 288: string(109) ".The hebrev function converts logical Hebrew text to visual text 289: .The function tries to avoid breaking words 290: " 291: ===DONE===