Annotation of embedaddon/php/ext/standard/tests/strings/ucwords_variation2.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test ucwords() function : usage variations - heredoc strings
3: --FILE--
4: <?php
5: /* Prototype : string ucwords ( string $str )
6: * Description: Uppercase the first character of each word in a string
7: * Source code: ext/standard/string.c
8: */
9:
10: /*
11: * test ucwords() with different string prepared using heredoc
12: */
13:
14: echo "*** Testing ucwords() : usage variations ***\n";
15:
16: // Null here doc string
17: $null_string = <<<EOT
18: EOT;
19:
20: // Heredoc string with blank line
21: $blank_line = <<<EOT
22:
23: EOT;
24:
25: // here doc with multiline string
26: $multiline_string = <<<EOT
27: testing ucword() with
28: multiline string using
29: heredoc
30: EOT;
31:
1.1.1.2 ! misho 32: // here doc with different whitespaces
1.1 misho 33: $diff_whitespaces = <<<EOT
34: testing\rucword(str)\twith
35: multiline string\t\tusing
36: heredoc\nstring.with\vdifferent\fwhite\vspaces
37: EOT;
38:
39: // here doc with numeric values
40: $numeric_string = <<<EOT
41: 12sting 123string 4567
42: string\t123string\r12 test\n5test
43: EOT;
44:
45: // heredoc with quote chars & slash
46: $quote_char_string = <<<EOT
47: it's bright,but i cann't see it.
48: "things in double quote"
49: 'things in single quote'
50: this\line is /with\slashs
51: EOT;
52:
53: $heredoc_strings = array(
54: $null_string,
55: $blank_line,
56: $multiline_string,
57: $diff_whitespaces,
58: $numeric_string,
59: $quote_char_string
60: );
61:
62: // loop through $heredoc_strings element and check the working on ucwords()
63: $count = 1;
64: for($index =0; $index < count($heredoc_strings); $index ++) {
65: echo "-- Iteration $count --\n";
66: var_dump( ucwords($heredoc_strings[$index]) );
67: $count ++;
68: }
69:
70: echo "Done\n";
71: ?>
72: --EXPECTF--
73: *** Testing ucwords() : usage variations ***
74: -- Iteration 1 --
75: string(0) ""
76: -- Iteration 2 --
77: string(0) ""
78: -- Iteration 3 --
79: string(52) "Testing Ucword() With
80: Multiline String Using
81: Heredoc"
82: -- Iteration 4 --
83: string(93) "Testing
Ucword(str) With
84: Multiline String Using
85: Heredoc
86: String.withDifferentWhiteSpaces"
87: -- Iteration 5 --
88: string(53) "12sting 123string 4567
89: String 123string
12 Test
90: 5test"
91: -- Iteration 6 --
92: string(108) "It's Bright,but I Cann't See It.
93: "things In Double Quote"
94: 'things In Single Quote'
95: This\line Is /with\slashs"
96: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>