Annotation of embedaddon/php/ext/standard/tests/strings/wordwrap_variation5.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test wordwrap() function : usage variations - valid break arguments(spaces)
3: --FILE--
4: <?php
5: /* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
6: * Description: Wraps buffer to selected number of characters using string break char
7: * Source code: ext/standard/string.c
8: */
9:
10: /*
11: *test wordwrap() with break arguments as single spaces
12: */
13:
14: echo "*** Testing wordwrap() : usage variations ***\n";
15:
16: // Initialize all required variables
17: $str = "Testing wordrap function";
18: $width = 1;
19: $cut = false;
20:
21: echo "\n-- Testing wordwrap() with default break value and single space as value --\n";
22: echo "-- with default break and cut value --\n";
23: var_dump( wordwrap($str, $width) ); // default break and cut value
24:
25: echo "-- with default cut value --\n";
26: $break = ' ';
27: $break1 = " ";
28: var_dump( wordwrap($str, $width, $break) );
29: var_dump( wordwrap($str, $width, $break1) );
30:
31: echo "-- with cut value as false --\n";
32: $cut = false;
33: var_dump( wordwrap($str, $width, $break, $cut) );
34: var_dump( wordwrap($str, $width, $break1, $cut) );
35:
36: echo "-- with cut value as true --\n";
37: $cut = true;
38: var_dump( wordwrap($str, $width, $break, $cut) );
39: var_dump( wordwrap($str, $width, $break1, $cut) );
40:
41: echo "Done\n";
42: ?>
43: --EXPECTF--
44: *** Testing wordwrap() : usage variations ***
45:
46: -- Testing wordwrap() with default break value and single space as value --
47: -- with default break and cut value --
48: string(24) "Testing
49: wordrap
50: function"
51: -- with default cut value --
52: string(24) "Testing wordrap function"
53: string(26) "Testing wordrap function"
54: -- with cut value as false --
55: string(24) "Testing wordrap function"
56: string(26) "Testing wordrap function"
57: -- with cut value as true --
58: string(43) "T e s t i n g w o r d r a p f u n c t i o n"
59: string(64) "T e s t i n g w o r d r a p f u n c t i o n"
60: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>