1--TEST--
2Test hebrevc() function : usage variations - test values for $max_chars_per_line argument
3--FILE--
4<?php
5
6/* Prototype  : string hebrevc  ( 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
11echo "*** Testing hebrevc() function: with unexpected inputs for 'max_chars_per_line' argument ***\n";
12
13//get an unset variable
14$unset_var = 'string_val';
15unset($unset_var);
16
17//defining a class
18class 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 hebrevc() function
79$count = 1;
80
81$hebrew_text = "The hebrevcc function converts logical Hebrew text to visual text.\nThis function is similar to hebrevc() with the difference that it converts newlines (\n) to '<br>\n'.\nThe function tries to avoid breaking words.\n";
82
83foreach($inputs as $max_chars_per_line) {
84  echo "-- Iteration $count --\n";
85  var_dump( hebrevc($hebrew_text, $max_chars_per_line) );
86  $count ++;
87}
88
89fclose($file_handle);  //closing the file handle
90
91?>
92===DONE===
93--EXPECTF--
94*** Testing hebrevc() function: with unexpected inputs for 'max_chars_per_line' argument ***
95-- Iteration 1 --
96string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
97) This function is similar to hebrevc() with the difference that it converts newlines<br />
98<to '<br (<br />
99.'<br />
100.The function tries to avoid breaking words<br />
101"
102-- Iteration 2 --
103string(331) "xttel uaisv<br />
104tot ext<br />
105ewbrHel cagilos rtveonc<br />
106ontincfuc vcreebh<br />
107he.Ts<br />
108neliewn<br />
109tsernvcot i<br />
110atthe ncrefeifd<br />
111het<br />
112thwi) c(evbrheo t<br />
113arilims<br />
114isn ioctunf<br />
115isTh) (<br />
116r <b'<br />
117to<<br />
118.'s<br />
119rdwog inakreb<br />
120idvoa<br />
121tos ietrn ioctunf<br />
122he.T<br />
123"
124-- Iteration 3 --
125string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
126) This function is similar to hebrevc() with the difference that it converts newlines<br />
127<to '<br (<br />
128.'<br />
129.The function tries to avoid breaking words<br />
130"
131-- Iteration 4 --
132string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
133) This function is similar to hebrevc() with the difference that it converts newlines<br />
134<to '<br (<br />
135.'<br />
136.The function tries to avoid breaking words<br />
137"
138-- Iteration 5 --
139string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
140) This function is similar to hebrevc() with the difference that it converts newlines<br />
141<to '<br (<br />
142.'<br />
143.The function tries to avoid breaking words<br />
144"
145-- Iteration 6 --
146string(421) "txet<br />
147lausiv<br />
148ot<br />
149txet<br />
150werbeH<br />
151lacigol<br />
152strevnoc<br />
153noitcnuf<br />
154ccverbeh<br />
155ehT.<br />
156senilwen<br />
157strevnoc<br />
158ti<br />
159taht<br />
160ecnereffid<br />
161eht<br />
162htiw<br />
163)(cverbeh<br />
164ot<br />
165ralimis<br />
166si<br />
167noitcnuf<br />
168sihT<br />
169)<br />
170(<br />
171rb<'<br />
172ot<<br />
173'.<br />
174sdrow<br />
175gnikaerb<br />
176diova<br />
177ot<br />
178seirt<br />
179noitcnuf<br />
180ehT.<br />
181"
182-- Iteration 7 --
183string(373) "text<br />
184to visual<br />
185text<br />
186Hebrew<br />
187logical<br />
188converts<br />
189function<br />
190hebrevcc<br />
191.The<br />
192newlines<br />
193converts<br />
194that it<br />
195difference<br />
196with the<br />
197hebrevc()<br />
198similar to<br />
199is<br />
200function<br />
201) This<br />
202<to '<br (<br />
203.'<br />
204words<br />
205breaking<br />
206to avoid<br />
207tries<br />
208function<br />
209.The<br />
210"
211-- Iteration 8 --
212string(421) "txet<br />
213lausiv<br />
214ot<br />
215txet<br />
216werbeH<br />
217lacigol<br />
218strevnoc<br />
219noitcnuf<br />
220ccverbeh<br />
221ehT.<br />
222senilwen<br />
223strevnoc<br />
224ti<br />
225taht<br />
226ecnereffid<br />
227eht<br />
228htiw<br />
229)(cverbeh<br />
230ot<br />
231ralimis<br />
232si<br />
233noitcnuf<br />
234sihT<br />
235)<br />
236(<br />
237rb<'<br />
238ot<<br />
239'.<br />
240sdrow<br />
241gnikaerb<br />
242diova<br />
243ot<br />
244seirt<br />
245noitcnuf<br />
246ehT.<br />
247"
248-- Iteration 9 --
249string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
250) This function is similar to hebrevc() with the difference that it converts newlines<br />
251<to '<br (<br />
252.'<br />
253.The function tries to avoid breaking words<br />
254"
255-- Iteration 10 --
256
257Warning: hebrevc() expects parameter 2 to be long, array given in %s on line %d
258NULL
259-- Iteration 11 --
260
261Warning: hebrevc() expects parameter 2 to be long, array given in %s on line %d
262NULL
263-- Iteration 12 --
264
265Warning: hebrevc() expects parameter 2 to be long, array given in %s on line %d
266NULL
267-- Iteration 13 --
268string(331) "xttel uaisv<br />
269tot ext<br />
270ewbrHel cagilos rtveonc<br />
271ontincfuc vcreebh<br />
272he.Ts<br />
273neliewn<br />
274tsernvcot i<br />
275atthe ncrefeifd<br />
276het<br />
277thwi) c(evbrheo t<br />
278arilims<br />
279isn ioctunf<br />
280isTh) (<br />
281r <b'<br />
282to<<br />
283.'s<br />
284rdwog inakreb<br />
285idvoa<br />
286tos ietrn ioctunf<br />
287he.T<br />
288"
289-- Iteration 14 --
290string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
291) This function is similar to hebrevc() with the difference that it converts newlines<br />
292<to '<br (<br />
293.'<br />
294.The function tries to avoid breaking words<br />
295"
296-- Iteration 15 --
297string(331) "xttel uaisv<br />
298tot ext<br />
299ewbrHel cagilos rtveonc<br />
300ontincfuc vcreebh<br />
301he.Ts<br />
302neliewn<br />
303tsernvcot i<br />
304atthe ncrefeifd<br />
305het<br />
306thwi) c(evbrheo t<br />
307arilims<br />
308isn ioctunf<br />
309isTh) (<br />
310r <b'<br />
311to<<br />
312.'s<br />
313rdwog inakreb<br />
314idvoa<br />
315tos ietrn ioctunf<br />
316he.T<br />
317"
318-- Iteration 16 --
319string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
320) This function is similar to hebrevc() with the difference that it converts newlines<br />
321<to '<br (<br />
322.'<br />
323.The function tries to avoid breaking words<br />
324"
325-- Iteration 17 --
326string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
327) This function is similar to hebrevc() with the difference that it converts newlines<br />
328<to '<br (<br />
329.'<br />
330.The function tries to avoid breaking words<br />
331"
332-- Iteration 18 --
333string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
334) This function is similar to hebrevc() with the difference that it converts newlines<br />
335<to '<br (<br />
336.'<br />
337.The function tries to avoid breaking words<br />
338"
339-- Iteration 19 --
340
341Warning: hebrevc() expects parameter 2 to be long, string given in %s on line %d
342NULL
343-- Iteration 20 --
344
345Warning: hebrevc() expects parameter 2 to be long, string given in %s on line %d
346NULL
347-- Iteration 21 --
348
349Notice: A non well formed numeric value encountered in %s on line %d
350string(349) "textual vis<br />
351to<br />
352textrew Heb<br />
353icallog<br />
354ertsconvion unctf<br />
355evcchebrThe .<br />
356inesnewlrts onvec<br />
357it<br />
358thatnce feredif<br />
359the<br />
360withc() brevhe<br />
361to<br />
362ilarsim<br />
363is<br />
364tionfunchis ) T<br />
365(<br />
366'<br<to .'<br />
367<br />
368ordsw<br />
369kingbreaoid av<br />
370to<br />
371riest<br />
372tionfuncThe .<br />
373"
374-- Iteration 22 --
375
376Notice: A non well formed numeric value encountered in %s on line %d
377string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
378) This function is similar to hebrevc() with the difference that it converts newlines<br />
379<to '<br (<br />
380.'<br />
381.The function tries to avoid breaking words<br />
382"
383-- Iteration 23 --
384string(349) "textual vis<br />
385to<br />
386textrew Heb<br />
387icallog<br />
388ertsconvion unctf<br />
389evcchebrThe .<br />
390inesnewlrts onvec<br />
391it<br />
392thatnce feredif<br />
393the<br />
394withc() brevhe<br />
395to<br />
396ilarsim<br />
397is<br />
398tionfunchis ) T<br />
399(<br />
400'<br<to .'<br />
401<br />
402ordsw<br />
403kingbreaoid av<br />
404to<br />
405riest<br />
406tionfuncThe .<br />
407"
408-- Iteration 24 --
409
410Warning: hebrevc() expects parameter 2 to be long, object given in %s on line %d
411NULL
412-- Iteration 25 --
413
414Warning: hebrevc() expects parameter 2 to be long, resource given in %s on line %d
415NULL
416-- Iteration 26 --
417string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
418) This function is similar to hebrevc() with the difference that it converts newlines<br />
419<to '<br (<br />
420.'<br />
421.The function tries to avoid breaking words<br />
422"
423-- Iteration 27 --
424string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
425) This function is similar to hebrevc() with the difference that it converts newlines<br />
426<to '<br (<br />
427.'<br />
428.The function tries to avoid breaking words<br />
429"
430===DONE===
431