summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/ucwords_variation2.phpt
diff options
context:
space:
mode:
authorRaghubansh Kumar <kraghuba@php.net>2007-09-07 14:44:52 +0000
committerRaghubansh Kumar <kraghuba@php.net>2007-09-07 14:44:52 +0000
commita14ef42c0c66953cb177c8fd486d82b975a00410 (patch)
treea9f5f7a2a91b3d36b3d5198a4a7bd4c1ebb8f5e1 /ext/standard/tests/strings/ucwords_variation2.phpt
parent67b4492c47195cdb11660870e2465605596a0b46 (diff)
downloadphp-git-a14ef42c0c66953cb177c8fd486d82b975a00410.tar.gz
New testcases for ucwords() function
Diffstat (limited to 'ext/standard/tests/strings/ucwords_variation2.phpt')
-rw-r--r--ext/standard/tests/strings/ucwords_variation2.phpt99
1 files changed, 99 insertions, 0 deletions
diff --git a/ext/standard/tests/strings/ucwords_variation2.phpt b/ext/standard/tests/strings/ucwords_variation2.phpt
new file mode 100644
index 0000000000..14f392eb19
--- /dev/null
+++ b/ext/standard/tests/strings/ucwords_variation2.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test ucwords() function : usage variations - heredoc strings
+--FILE--
+<?php
+/* Prototype : string ucwords ( string $str )
+ * Description: Uppercase the first character of each word in a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * test ucwords() with different string prepared using heredoc
+*/
+
+echo "*** Testing ucwords() : usage variations ***\n";
+
+// Null here doc string
+$null_string = <<<EOT
+EOT;
+
+// Heredoc string with blank line
+$blank_line = <<<EOT
+
+EOT;
+
+// here doc with multiline string
+$multiline_string = <<<EOT
+testing ucword() with
+multiline string using
+heredoc
+EOT;
+
+// here doc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+testing\rucword(str)\twith
+multiline string\t\tusing
+heredoc\nstring.with\vdifferent\fwhite\vspaces
+EOT;
+
+// here doc with numeric values
+$numeric_string = <<<EOT
+12sting 123string 4567
+string\t123string\r12 test\n5test
+EOT;
+
+// heredoc with quote chars & slash
+$quote_char_string = <<<EOT
+it's bright,but i cann't see it.
+"things in double quote"
+'things in single quote'
+this\line is /with\slashs
+EOT;
+
+$heredoc_strings = array(
+ $null_string,
+ $blank_line,
+ $multiline_string,
+ $diff_whitespaces,
+ $numeric_string,
+ $quote_char_string
+);
+
+// loop through $heredoc_strings element and check the working on ucwords()
+$count = 1;
+for($index =0; $index < count($heredoc_strings); $index ++) {
+ echo "-- Iteration $count --\n";
+ var_dump( ucwords($heredoc_strings[$index]) );
+ $count ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ucwords() : usage variations ***
+-- Iteration 1 --
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+-- Iteration 3 --
+string(52) "Testing Ucword() With
+Multiline String Using
+Heredoc"
+-- Iteration 4 --
+string(96) "Testing
+Ucword(str) With
+Multiline String Using
+Heredoc
+String.with\vdifferent\fwhite\vspaces"
+-- Iteration 5 --
+string(53) "12sting 123string 4567
+String 123string
+12 Test
+5test"
+-- Iteration 6 --
+string(108) "It's Bright,but I Cann't See It.
+"things In Double Quote"
+'things In Single Quote'
+This\line Is /with\slashs"
+Done
+